Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


BSt

Member Since 18 Feb 2012
Offline Last Active Mar 15 2012 08:45 AM

Topics I've Started

Cannot open include file: '../../../lib/vc_lib/msw/wx/setup.h

14 March 2012 - 04:25 PM

I have downloaded WXPorts and unpacked in C:/lib/wxWidgets/, then i created a new project in MVSC++ 2010, next I set my project properties:
VC++ Directories:

Include dirs.: $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;C:\libs\wxWidgets-2.8.12\include\;C:\libs\wxWidgets-2.8.12\include\msvc\
Library dirs.: $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;C:\wxWidgets-2.8.7\lib\vc_lib\mswd;
Source dirs.: $(VCInstallDir)atlmfc\src\mfc;$(VCInstallDir)atlmfc\src\mfcm;$(VCInstallDir)atlmfc\src\atl;$(VCInstallDir)crt\src;C:\libs\wxWidgets-2.8.12\src;


Next i had included anitest.cpp and anitest.h to my project and compiled it.

I got this one:

1>C:\libs\wxWidgets-2.8.12\include\msvc\wx/setup.h(142): fatal error C1083: Cannot open include file: '../../../lib/vc_lib/msw/wx/setup.h': No such file or directory


Can you help me with that?

Bitmap dosen't work.

10 March 2012 - 11:31 AM

Any errors, but i can't see my bitmap in window. I also added bitmap in my project.

API.cpp
#include <windows.h>
#include <iostream>
#include <sstream>
#include <WindowsX.h>
#include <string>
#include <cstdio>
#include "resource_bg.h"
#define WIN32_LEAN_AND_MEAN
LPSTR className = "test";
UINT windowWidth = 460;
UINT windowHeight = 220;
char serverName[] = "test";
char titleText[256];
LPSTR windowName;
HBITMAP bg_bitmap;
BITMAP info_bitmap;
LRESULT CALLBACK WindowEventProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lParam);
/////////////////////////////////////////////////////////
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
sprintf_s(titleText, "Launcher %s", serverName);
windowName = (LPSTR)titleText;
WNDCLASSEX windowClass;
ZeroMemory (&windowClass, sizeof(WNDCLASSEX));
windowClass.cbSize = sizeof (WNDCLASSEX);
windowClass.style = CS_OWNDC;
windowClass.lpfnWndProc = WindowEventProc;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = hInstance;
windowClass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
windowClass.hCursor = LoadCursor (NULL, IDC_ARROW);
windowClass.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = className;
windowClass.hIconSm = LoadIcon (NULL, IDI_APPLICATION);

if (!RegisterClassEx(&windowClass)){
  MessageBox (NULL, "There is a problem with your device.", "Error",
  MB_ICONEXCLAMATION | MB_OK);
  return 1;
}
HWND hWindow;
hWindow = CreateWindowEx(NULL,			
						 className,  
						  windowName,  
						  WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
						  100,	
						  100,	
						  windowWidth,  
						  windowHeight,	  
						  NULL,				
						  NULL,				
						  hInstance,		  
						  NULL);			

  
  
	HWND hPrzyc = CreateWindowEx( 0, "BUTTON", "Dialog", WS_CHILD | WS_VISIBLE,
	5, 5, 50, 25, hWindow, NULL, hInstance, NULL );
HBITMAP bg_bitmap = (HBITMAP)LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_BITMAP2), IMAGE_BITMAP,0,0,0);
  if(bg_bitmap==0)
   {
	 MessageBox(0,"Problem z wczytaniem bitmapy.","Brak pliku",MB_ICONERROR);
	 return 0;
   }
GetObject(bg_bitmap,sizeof(BITMAP),&info_bitmap);
ShowWindow (hWindow, nCmdShow);
UpdateWindow (hWindow);
   // Messages loop
   MSG msgStatement;
   while (GetMessage(&msgStatement, NULL, 0, 0)){
		 TranslateMessage (&msgStatement);
		 DispatchMessage (&msgStatement);
   }
   return static_cast<int>(msgStatement.wParam);
}
/////////////////////////////////////////////////////////
LRESULT CALLBACK WindowEventProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lParam){
switch (uMsg)  {
  HDC hdc, hdcBitmapy;
  PAINTSTRUCT ps;
  case WM_PAINT: {
	hdc=BeginPaint(hWindow,&ps);
	hdcBitmapy=CreateCompatibleDC(hdc);
	bg_bitmap=(HBITMAP)SelectObject(hdcBitmapy,bg_bitmap);
	BitBlt(hdc,0,0,1000,1000,hdcBitmapy,0,0,SRCCOPY);
	bg_bitmap=(HBITMAP)SelectObject(hdcBitmapy,bg_bitmap);
	DeleteDC(hdcBitmapy);
	EndPaint(hWindow,&ps);
	break;
  
  }
  case WM_DESTROY: {
   PostQuitMessage (0);
   return 0;
  }
}
   return DefWindowProc(hWindow, uMsg, wParam, lParam);
}

resource_bg.h
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif
#define IDB_BITMAP2 101

bgres.rc
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource_bg.h"


//
// Bitmap resources
//
LANGUAGE 0, SUBLANG_NEUTRAL
IDB_BITMAP2		BITMAP		 "bitmap1.bmp"

[WinApi] Default text in combobox .

02 March 2012 - 02:28 PM

Hello.

How Can i set my default text in combo box? I mean this text: for example - ^Click here^

HWND hCombo = CreateWindowEx( WS_EX_CLIENTEDGE, "COMBOBOX", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER |
CBS_DROPDOWN, 50, 50, 150, 200, hwnd, NULL, hInstance, NULL );

SendMessage( hCombo, CB_ADDSTRING, 0,( LPARAM ) "e1" );
SendMessage( hCombo, CB_ADDSTRING, 0,( LPARAM ) "e2" );

PARTNERS