|
What I do is write a custom draw handler, and in the CDDS_PREPAINT stage, if the list is empty, call TextOut() to display "There are no items to show" or whatever message you want.
--Mike--
http://home.inreach.com/mdunn/
A recent survey reports that 1/4 of all internet users in England surf for porn.
The other 3/4 just didn't want to admit it.
|
|
|
|
|
Hello,
How can I resize my dialog height to fit the screen - the taskbar when someone drags it to the edge of the screen? I don't want all the specifics just some explanation. Currently I have a dialog that snaps to the screen border and when it snaps to the screen edge I use SetWindowPos(NULL, 0, 0, rc.Width(), rcDesktop.Height() - bottomTaskbar, SWP_NOMOVE|SWP_NOSENDCHANGING); but it keeps resetting it back to its normal size after I call that... any ideas? Thanks in advance.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Type A:
// the following code is OK
CFileFind l_Blah;
l_Blah.FindSomthing("c:\\dir123\\*.abc");
while (l_Blah.FindNextFile())
{
l_Blah.GetFilePath();
}
Type B:
// and the following code is NOT OK
CFileFind l_Blah;
CFileFind l_Blah;
l_Blah.FindSomthing("c:\\dir123\\*.abc");
l_Blah.GetFilePath(); // <--- this line makes an error
while (l_Blah.FindNextFile())
{
l_Blah.GetFilePath();
}
if I use Type A, I always lose the first file that found.
What can I do????????????
Name: STR
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject"
|
|
|
|
|
You need to do it something like this
CFileFind finder;
BOOL bContinue = finder.FindFile("bla.bla.bla");
while (bContinue)
{
...
finder.GetFilePath();
...
bContinue = finder.FindNextFile();
}
|
|
|
|
|
I need to correct something
CFileFind finder;
BOOL bContinue = finder.FindFile("bla.bla.bla");
while (bContinue)
{
...
finder.GetFilePath(); <=You will have a crash here.
...
bContinue = finder.FindNextFile();
}
this is the correct mode.
CFileFind finder;
BOOL bContinue = finder.FindFile("bla.bla.bla");
while(bContinue)
{
...
bContinue = finder.FindNextFile();}
finder.GetFilePath();
...
}
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
Hello,
Is it possible to rotate a dialog completely (title bar and all)? Say I want to tilt the dialog onto its side, possible? How? Thanks.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Hello,
I am tracking the TME_LEAVE mouse event in my dialog based app but even if it still has focus and I move the mouse to the listbox control then this message fires. Is there anyway to have it work like a "real" leave, say when it leaves my app? Any help is greatly appreciated.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
What would be the best way to pass a callback function to a DLL? I want to do something like this:
In the Dll...
BOOL declspec(dllexport) __stdcall InstallKeyboardHook(HOOKPROC proc)
{
g_hKeyboardHook=SetWindowsHookEx(WH_KEYBOARD, proc, g_hInstance, 0);
return g_hKeyboardHook ? TRUE : FALSE;
}
In the executable, after LoadLibrary and GetProcAddress...
InstallKeyboardHook(MyHookProc);
LRESULT CALLBACK MyHookProc(int code, WPARAM wParam, LPARAM lParam)
{
MessageBeep((UINT)-1);
}
I don't get any errors, but I don't get any beeps from key presses, either. HELP!!!!
Thanks in advance.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
if you want to catch the WM_KEYDOWN or WM_KEYUP before the message is sent to any other window,
Change:
BOOL declspec(dllexport) __stdcall InstallKeyboardHook(HOOKPROC proc)
To:
BOOL declspec(dllexport) __stdcall InstallKeyboardHook()
I guess that YourHookProc is in the executable file, when it should be in the dll.
In the executable,
you should call only InstallHook() and UninstallHook();
BTW:
you should here beep if you hit a key when the thread is on focus.
try creating a MessageBox under the same thread that called InstallHook(...) and hit space when the message box is open.
DONT FORGET:
Turn on you speakers
Let me know if I helped you.
I did this kind of app, but insted of beep I used the ICQ's MsgType.wav
if you want to check it out, let me know
Name: STR
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject"
|
|
|
|
|
The hook function (MyHookProc) needs to be in a DLL if it's a global hook.
> Andrew
"Do you like my mask, it raises the dead...!"
-- Buffy (season 3, Giles)
|
|
|
|
|
when creating the thread function that gets passed to the AfxBeginThread() function, does this function have to be a global function or can it be say a function of a View/Doc class ... or does it matter???
Bryan ~
|
|
|
|
|
It can be a global function or a static member function of a class. However, you can fake a normal member function by passing the address of an object to the thread function, and then use that to access the members of the object.
Hope that helps,
> Andrew
"Do you like my mask, it raises the dead...!"
-- Buffy (season 3, Giles)
|
|
|
|
|
I have a project that I'm working on and I need the background of my SDI (using VC++ and MFC) to be white but I can't seem to figure out how to do this ... any sugestions??
Thanks -
|
|
|
|
|
You should be able to use something similar to the folowing;
BOOL CYourView::OnEraseBkgnd ( CDC * pDC ) {<br />
<br />
CBrush brush;<br />
brush.CreateSolidBrush ( RGB ( 200, 0, 0 ) );<br />
<br />
CBrush * pOldBrush = pDC->SelectObject ( &brush );<br />
<br />
CRect rect;<br />
GetClientRect ( &rect );<br />
pDC->PatBlt ( 0, 0, rect.Width (), rect.Height (), PATCOPY );<br />
<br />
pDC->SelectObject ( pOldBrush );<br />
<br />
return 0;<br />
}
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Hello,
I have a ListView class, displayed in report mode. How can i change the font of the text displayed in columns and header.
Thanks.
Regards,
Ganesh.M.Ramaswamy
|
|
|
|
|
You can do it with the custom draw feature that ListView controls have. Search your docs for the NM_CUSTOMDRAW notification message to get the details.
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
After I've added a new class and realize that I didn't build it right, how can I make it go away si I can rebuild it?
Richard
|
|
|
|
|
delete the .cpp and .h, remove the files from your workspace and then delete your project's .clw file.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Hey guys
can anyone tell me why i am getting these compiler errors and how to fix them:-
Linking...
Creating library Debug/Software to Sign and Verify Files.lib and object Debug/Software to Sign and Verify Files.exp
Crypto.obj : error LNK2001: unresolved external symbol __imp__CertOpenSystemStoreA@8
Crypto.obj : error LNK2001: unresolved external symbol __imp__CertFreeCertificateContext@4
Crypto.obj : error LNK2001: unresolved external symbol __imp__CertGetCertificateContextProperty@16
Crypto.obj : error LNK2001: unresolved external symbol __imp__CertEnumCertificatesInStore@8
Debug/Software to Sign and Verify Files.dll : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
Cheeers
Peter
|
|
|
|
|
Hi,
did you specify the crypto API import library in your project settings?
If not - go to project -> settings -> link -> input and add "Crypt32.lib" to list of linked import libs.
Whenever you use specific win32 api functions, you should check the win32 api docs "requirements" section of the functions.
Regards,
A.Focht.
|
|
|
|
|
You are missing a .lib file. I think that you need to link with the crypto32.lib
Cheers
Carlos Antollini.
|
|
|
|
|
Hi,
I've been writing DLL that attaches to any process by using global hook, and I need to handle attach/detach operation. It is working fine except when I abort debugging program with msdev. I'm using Japanese version of msdev so I can't tell you the exact name of menu title to ABORT debugging, but we sometimes do that for various reasons. In that case, DllMain was not called with DLL_PROCESS_DETACH. And it seems DLL is left loaded. (The reason I think so is: I can't delete that DLL file even after I ended my application which unloads all DLLs from memory.) I'm doing this on Win2K. And not that program being debugged with msdev is not a program that loads the DLL and let attach to processes.
Is that a problem by design? If someone knows any documents describing this, please let me know.
Thanks.
Kurotora
|
|
|
|
|
There may be a hint in the TerminateProcess API docs:
TerminateProcess causes all threads within a process to terminate, and causes a process to exit, but DLLs attached to the process are not notified that the process is terminating.
So, if 'End debugging' command is implemented with a call to TerminateProcess, your DLL won't be nofified.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tomasz,
Thank you giving me hint. Can you/anyone let me clear that DLLs are unloaded but not just notified to it? Basically it should I hope though I had a problem with never-unloading-dll.
Thanks.
I love Code Project, do you?
Kurotora
|
|
|
|
|
Stupid Question but....
Did you use, the FreeLibrary() function in your Aplication?
Regards
Carlos Antollini.
|
|
|
|