|
So, I got a little bored and decided to create a desktop locker through the screensaver function of windows. I'm running XP and Dev C++ 4.9.9.2 and Dev is causing my problem. Other places I've checked said i would need to link "comctl32.lib" which I can't seem to locate on my computer or the internet for download. Incase it would be of any use I'll post my program code.
#include <iostream>
#include <windows.h>
#include <scrnsave.h>
unsigned char new1;
using namespace std;
LONG WINAPI ScreenSaverProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{
switch(message)
{
case WM_CREATE:
return 0;
case WM_ERASEBKGND:
return 0;
case WM_TIMER:
uTimer = SetTimer(hwnd, 1, 1000, NULL);
return 0;
case WM_DESTROY:
KillTimer(hwnd, uTimer);
PostQuitMessage(0);
return 0;
}
return DefScreenSaverProc(hwnd,message,wparam,lparam);
}
BOOL WINAPI ScreenSaverConfigureDialog(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{
return true;
}
BOOL WINAPI RegisterDialogClasses(HANDLE hmodule)
{
return true;
}
I receive an error with the "uTimer = SetTimer(hwnd, 1, 1000, NULL);" line of code, but I'm assuming that its linked to the comctl32.lib considering I read scrnsave.h requires it; also the code compiles but does not work without the uTimer line.
|
|
|
|
|
Suposedly comctl32.lib comes with Microsoft's Platform SDK (you can download that from the MS site), i checked on my system and it sits in "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib" (yes, yes, i am still using VS2003, so sue me ), so the platform SDK thing seems to be right. No idea if you can use that with Dev C++ or not...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
SetTimer is linked in via user32.dll, not the common controls library. Do you have any of the Windows Platform SDKs installed? (I'm not sure what Dev C++ comes with as far as built-in libraries...)
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
No I don't have the SDK platforms, I have VS2008 on another computer or older harddrive somewhere but I have no idea which one and don't exactly prefer using VS over Dev.
|
|
|
|
|
Any info on how to use zlib to decompress .gzip file in C
I have one .gz file and i need to decompres w/o using system command in my c code?
Thanks
|
|
|
|
|
|
You don't need zlib.
zip/unzip is native in windows (Shell)
|
|
|
|
|
I use Connect serial port rs-232
In windos XP platform
|
|
|
|
|
|
my function in dll:
extern "C" _declspec(dllexport) CDialog * ShowDllDlg(HWND hWnd)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CDllDlg * m_pDlg =new CDllDlg();
m_pDlg->Create(IDD_DLG_DllDLG, CWnd::FromHandle(hWnd));
m_pDlg->ShowWindow(SW_SHOW);
return m_pDlg;
}
Another function to call dll function in my test project:
void CTestDlg::OnBnClickedButtonDlltest()
{
HWND myhWnd = this->m_hWnd;
typedef CDialog * (_stdcall *Connect)(HWND hWnd);
HINSTANCE hinstDLL=NULL;
hinstDLL = ::LoadLibrary("AntiSubmarine.dll");
if (hinstDLL) {
Connect Proc;
Proc = (Connect)GetProcAddress(hinstDLL,"ShowDllDlg");
if (Proc!=(Connect)NULL) {
m_pdlg = (CDialog *)Proc(myhWnd);//in *.h file defines CDialog * m_pdlg;
//if only "Proc(myhWnd)", also the same error;
}
FreeLibrary(hinstDLL);
}
else {
AfxMessageBox("Not found dll !");
}
return;
}
when run the dll, error comes out.
modified on Wednesday, August 19, 2009 8:47 AM
|
|
|
|
|
because you free the library after creating a modless dialog, so the error happened.
it's my pleasure to make friend with you.
|
|
|
|
|
First, thank you very much for your help.
You said "free the library after creating a modless dialog". Beacuse I do not understand the dll, and for some resons, i have to use it with modless dialog. So, could you help me to edit the codes, and make the program run freely.
Finally, thanks.
it's my pleasure to make friend with you.
|
|
|
|
|
void CTestDlg::OnBnClickedButtonDlltest()
{
HWND myhWnd = this->m_hWnd;
typedef CDialog * (_stdcall *Connect)(HWND hWnd);
HINSTANCE hinstDLL=NULL;
hinstDLL = ::LoadLibrary("AntiSubmarine.dll");
if (hinstDLL) {
Connect Proc;
Proc = (Connect)GetProcAddress(hinstDLL,"ShowDllDlg");
if (Proc!=(Connect)NULL) {
m_pdlg = (CDialog *)Proc(myhWnd);
}
}
else {
AfxMessageBox("Not found dll !");
}
return;
}
if you create a modless dialog, don't free the library which include the dialog resource until you destroy the dialog, because that modless dialog is not block like mod dialog.
it's my pleasure to make friend with you.
|
|
|
|
|
Thank you very much for your answers.
I'll try it again. if there is any error, could you help me again? May I have your Emaill for contact in the future?
my Emaill: hailuolan@yahoo.com.cn
it's my pleasure to make friend with you.
|
|
|
|
|
Hi All,
In my program i need a combo box looks just like the one shown in the pic. I learned that i need to subclass it. But the prob i need to fix is the contents of each row as you can see that each row is divided into 3 portions. 1)image on the left,2)name of the file with bigger font,3) path to access that file in smaller font. Please tell me how can i achieve this divisions in one row.
image
Regards,
J
modified on Saturday, August 15, 2009 4:23 AM
|
|
|
|
|
Did you try using the CBS_OWNERDRAWFIXED or CBS_OWNERDRAWVARIABLE styles (See this[^] for details) on your combo box?
(btw your "image link" doesn't give me an image at all)
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thanks, I have corrected the image link
|
|
|
|
|
I write bitmap.c display bitmap > 256 color on screen
But I have VGA card on board.Result bad color.
How to: display bitmap > 256 color on screen ?
Palette have ...color ?
Struct of bitmap:
Struct tagBITMAP{
Word w,h;
Byte *data;
Byte palette[256*3];
}BITMAP;
Or answer is:1.
Desktop> right button click\properties\Setting\Display:Plug &
Play on intel(R) 82845G GL/GE/PE/GV Graphics Controller
Color Qualtily:Hightest(32 bit)
2.I change 16 bit to 32 bit.how to do ?
write boot.asm -> compiler NASM-> strip header -. not copy to floppy disk,I copt to CD-ROM,normal as floppy.Can I do ?
Floppy is old man.clear it
Help me
How to:compile this code with NASM 2.
--End,vietnam not register on www.osdev.org.
Please,register osdev for me.Account:TUAN_OS
My Mail:thoong00biet@yahoo.com.vn
|
|
|
|
|
mark
it's my pleasure to make friend with you.
|
|
|
|
|
I write bitmap.c display bitmap > 256 color on screen
But I have VGA card on board.Result bad color.
How to: display bitmap > 256 color on screen ?
Palette have ...color ?
Struct of bitmap:
Struct tagBITMAP{
Word w,h;
Byte *data;
Byte palette[256*3];
}BITMAP;
Or answer is:1.
Desktop> click fải\properties\Setting\Display:Plug &
Play on intel(R) 82845G GL/GE/PE/GV Graphics Controller
Color Qualtily:Hightest(32 bit)
2.I change 16 bit to 32 bit.how to do ?
I write boot.asm->compiler->strip header->not copy to floppy,I copy to CD.I do it ?
Floppy is old man,not use it
Help me
How to:compile this code with NASM 2.
--End,vietnam not register on www.osdev.org.
Please,register osdev for me.Account:TUAN_OS
My Mail:thoong00biet@yahoo.com.vn
|
|
|
|
|
|
tuan1111 wrote: I write boot.asm->compiler->strip header->not copy to floppy,I copy to CD.I do it ?
Why go to all that trouble when you can use virtualization? You can just build your OS and boot directly into it with the VM.
I am a lean mean ground beef machine!!!
|
|
|
|
|
Hi,
changing from VC7 to VC8 I get this linker error:
1>aiunittest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __stdcall ping(int)" (__imp_?ping@@YGHH@Z) referenced in function _main
The above code worked fine with VC7. Any ideas?
Thanks,
Uli
|
|
|
|
|
Compare the contents of
Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies.
You're probably missing an entry in VC8.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I am successfully creating tree nodes using the TVINSERTSTRUCT. I have 4 levels of child nodes and need to add another nodes to the last one as siblings.
I can use GetNextItem to retrieve HTREEITEM ( verified by getting the node text sting) but I am unable to get the actual tree TVITEM item where I will need the LPARAM for further processing.
Here is the essence of the code:
HTREEITEM hTreeItem;
TVINSERTSTRUCT * pItem = new TVINSERTSTRUCT ();
// first child
hTreeItem = m_ctrlTree.GetNextItem(NULL, TVGN_CHILD );
strNode = m_ctrlTree.GetItemText(hTreeItem ); // TOK
do
{
hTreeItem = m_ctrlTree.GetNextItem(hTreeItem , TVGN_CHILD );
strNode = m_ctrlTree.GetItemText(hTreeItem );//TOK
m_ctrlTree.SelectItem( hTreeItem ); // did not help
if(!m_ctrlTree.GetItem(&pItem->item ))
TRACE ("Failed”);
|
|
|
|