im trying to show a window from inside of a dll and i am doing it like this
Code:
int WINAPI CreateWindows(HINSTANCE , HINSTANCE , LPSTR , int);
Global^
Code:
CreateWindows(GetModuleHandle(0), NULL, NULL , NULL);
^calling from a certain part of the dll
Code:
int WINAPI CreateWindows(HINSTANCE hInstance, HINSTANCE hPrevInstance , LPSTR szCmdLine, int iCmdShow)
{
char szAppName[] = "tabs";
MSG msg;
WNDCLASSEX wc;
TCITEM tabs;
INITCOMMONCONTROLSEX iccx;
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = WndProc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
wc.hIcon = LoadIcon(NULL , IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL , IDC_ARROW);
wc.lpszClassName = szAppName;
wc.lpszMenuName = NULL;
if(!RegisterClassEx(&wc)) MessageBox(0 , "Error" , "error" , 0);
iccx.dwSize = sizeof(INITCOMMONCONTROLSEX);
iccx.dwICC = ICC_TAB_CLASSES;
InitCommonControlsEx(&iccx);
hwnd = CreateWindowEx(0 , szAppName , "Logs" ,
WS_OVERLAPPEDWINDOW ,
CW_USEDEFAULT , CW_USEDEFAULT,
CW_USEDEFAULT , CW_USEDEFAULT,
NULL , NULL , hInstance , NULL);
hwndTab = CreateWindowEx(0 , WC_TABCONTROL , NULL,
WS_VISIBLE | WS_CHILD | TCS_FIXEDWIDTH ,
0 , 0 , 0 , 0 ,
hwnd ,
NULL ,
(HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE),
NULL);
UpdateWindow(hwnd);
ShowWindow(hwnd , SW_SHOW);
ZeroMemory(&tabs, sizeof(TCITEM));
tabs.mask=TCIF_TEXT;
tabs.pszText= "Log";
tabs.cchTextMax = strlen(tabs.pszText);
SendMessage(hwndTab, TCM_INSERTITEM, 0, (LPARAM)&tabs);
tabs.pszText = "Proccessed Packets";
tabs.cchTextMax = strlen(tabs.pszText);
SendMessage(hwndTab, TCM_INSERTITEM, 1, (LPARAM)&tabs);
SendMessage(hwndTab, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
while(GetMessage(&msg , NULL , 0 , 0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
the function to do the rest^
the problem is it is not registering the window class, does any one know why this is, im thinking it is because i am using NULL's in the function parameters but i couldnt think of another way,
thanks