Har lige prøvet noget med en .rc fil, men det virker ikke helt:
[socket.cpp]
#include "windows.h"
#include "socketres.h"
HINSTANCE hInstance;
HWND MainWindow;
LRESULT CALLBACK MainWndProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
HWND CreateMainWindow()
{
WNDCLASS wc;
memset(&wc, 0, sizeof(WNDCLASS));
wc.lpfnWndProc = (WNDPROC )MainWndProc;
wc.hInstance = hInstance;
wc.hbrBackground = (HBRUSH )(COLOR_WINDOW + 1);
wc.lpszClassName = "Socket";
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
RegisterClass(&wc);
return DialogBox(hInstance,
MAKEINTRESOURCE(IDD_MAINDIALOG),
NULL,
(DLGPROC )DialogFunc);
}
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstanve,
LPSTR lpCmdLine,
INT nCmdShow)
{
if((MainWindow = CreateMainWindow()) == (HWND )0)
{
MessageBox(0,
"Failed to create MainWindow!",
"Warning",
MB_OK);
return 0;
}
ShowWindow(MainWindow, SW_SHOW);
MSG Msg;
while(GetMessage(&Msg, 0, 0, 0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
[socket.rc]
#include "windows.h"
#include "socketres.h"
IDD_MainDialog DIALOG 0, 0, 230, 230
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_CENTER
CAPTION "Socket Window"
FONT 8, "MS Sans Serif"
BEGIN
END
[socketres.h]
#define IDD_MAINDIALOG 100
- php-4ever
[Redigeret d. 11/02-05 16:55:20 af php-4ever]