|
Try ATL Dlls,
They are more powerful!
Cheers.
|
|
|
|
|
It worked, thanks a lot!!
|
|
|
|
|
I am looking for a way to obtain the location of the "Temporary Internet Files" using WinInet. Does anyone know?
|
|
|
|
|
Ok, got it. Its using shell and not wininet. SHGetFolderPath with CSIDL_INTERNET_CACHE.
But I see two locations where Temporary Internet Files folder exists. One in C:\Documents and Settings\username\Local Settings\ and the other in C:\Documents and Settings\username\Local Settings\Temp - does any one know what is the second one? The contents of this folder dont get cleared when I delete files from IE tools options. Thisis there both on winxp and win2k.
Thanks in advance.
|
|
|
|
|
Hi
I am using the following code to set my work area and to hide the task bar.
<br />
::ShowWindow(::FindWindow(_T("Shell_TrayWnd"), NULL));<br />
CRect rectWorkArea = CRect(0, 0, ::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN));<br />
SystemParametersInfo(SPI_SETWORKAREA,0,&rectWorkArea,SPIF_SENDCHANGE);<br />
When I set my application to full screen/maximize (or any other application actually), the application will not use the space occupied by the hidden task bar, nor will I be able to resize it to use the area. I can drag it to occupy the space, but I have also noticed the window outline for dragging doesn't get display there either.
When I do a SPIG_GETWORKAREA later, it still shows the old work area that includes the task bar.
The Taskbar app found on code guru also exhibits this behaviour.
Has anyone else had this problem and how did you get around it?
I am using Windows 2000 SP4, but it also happens on Windows XP SP2.
Thanks in advance.
|
|
|
|
|
Oops, looks like it was my fault. It looks like my WM_GETMINMAXINFO message handler was misbehaving. If I set bHandled = FALSE it seems to work now.
|
|
|
|
|
Hello. I've been wondering, when an exception is thrown (i.e. by using throw keyword) and there is no catch clause available, is there any function or subroutine that will be executed before the program finalizes? Is atexit called when such an exception is thrown?
Thanks.
KK.
One day you'll find
that I have gone,
for tomorrow may rain, so
I'll follow the sun...
|
|
|
|
|
Yes, it's possible to write a handler for any uncaught exceptions for your applications. I'm not sure if it's done by a try/catch at the top level, or if some other mechanism exists though.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The debugger should catch it and then you fix the problem.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
SetUnhandledExceptionFilter should be the thing you are looking for.
You can set a global exception filter with it.
Don't try it, just do it!
|
|
|
|
|
Hi everybody, I need your help.
I have a resizable dialog box with some controls (button, edit box, list box, etc). I have a Class that derive from « Paolo Messina CResizable » class. Every things works well.
Now I want to dock that dialog box (docking the dialog to the main frame). I try to do it, but it doesn’t work.
So, any ideas are welcome even if I would restart from scratch.
Thanks.
|
|
|
|
|
|
Thanks,
But it cann't help me because i want my controls inside a dockable dialog to
be resizable like in CResizableLib of Paolo Messina.
|
|
|
|
|
But you can derive Cristi's CSizingControlBar and put anything you want inside. I made it several months ago with a resizable child dialog containing listview, static and button controls. You only need to reposition the child dialog when the control bar is resized, then to override the OnSize handler in the child dialog to reposition correctly its controls.
|
|
|
|
|
I'm trying to detect when the user presses Ctrl/End. My PreTranslateMsg() override always computes the Ctrl key as not being pressed. Obviously, I'm doing something wrong. A gentle nudge in the right direction would be appreciated.
BOOL CMyCtrl::PreTranslateMessage (MSG* pMsg)
{
BYTE pressedKeys [256];
ZeroMemory (pressedKeys, sizeof (pressedKeys));
VERIFY (::GetKeyboardState (pressedKeys));
bool bCtrl = (pressedKeys [VK_CONTROL] & 255) == 255;
if (pMsg->message == WM_KEYDOWN) {
switch (pMsg->wParam) {
case VK_DELETE:
m_pModel->notifyDeleteKey();
break;
case VK_RETURN:
m_pModel->notifyEnterKey();
break;
case VK_HOME:
case VK_END:
case VK_LEFT:
case VK_RIGHT:
case VK_UP:
case VK_DOWN:
m_pModel->notifyNavKey (pMsg->wParam, bCtrl);
break;
}
}
return CWnd::PreTranslateMessage(pMsg);
} My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib@ravib.com
|
|
|
|
|
Does End send WM_KEYDOWN or WM_CHAR ? If so, I'd use GetAsycKeyState to check if Control was down at the same time.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am with Christian on this one. When I track regular virtual key presses, I always use GetAsycKeyState to test for the CTRL, SHIFT, etc. I have always experienced seriously mixed results with the GetKeyState function, so I don't use GetKeyState anymore.
This note in MSDN for GetKeyState about sums it up for me:
The key status returned from this function changes as a thread reads key messages from its message queue. The status does not reflect the interrupt-level state associated with the hardware. Use the GetAsyncKeyState function to retrieve that information.
|
|
|
|
|
This is what I use...
<br />
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_END)<br />
{<br />
BOOL bCtrlKeyDown = ((GetKeyState(VK_CONTROL) & ~1) != 0);<br />
<br />
if (bCtrlKeyDown)<br />
AfxMessageBox(_T("woof, woof"));<br />
}<br />
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Painted on the side of a dog trainer's van: SIT HAPPENS
|
|
|
|
|
if ((GetKeyState(VK_CONTROL) & 0x8000) )
This works for me nicely.
Einstein: "Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."
My Articles
|
|
|
|
|
Gak! I was & ing with 255 instead of 0x8000 ! Thanks, guys!
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib@ravib.com
|
|
|
|
|
When I create my worker thread and pass a char array, will my data be lost if in my main app I wrote over my char array with new data? Here is my thread creation code:
<br />
CWinThread* thread = AfxBeginThread(MyIOThread, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);<br />
thread->m_bAutoDelete = TRUE;<br />
thread->ResumeThread();<br />
<br />
Here is my worker code:
<br />
UINT CLAQTermDlg::MyIOThread(LPVOID pParam )<br />
{<br />
CLAQTermDlg * myDlg = (CLAQTermDlg *)pParam;<br />
<br />
::MessageBox(NULL, myDlg->sText, "In my Thread", MB_OK );<br />
return 0;
}<br />
Will the myDlg->sText be over written if in my main app I write over it with something else?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Yes. Threads share the same memory space as the other threads within the program.
Worse, if you modify that same string from your main thread and worker thread at the same time, you might get some unprdictable and undesireable results.
Data access like that should be protected with a CriticalSection.
|
|
|
|
|
Blake two quick questions
1. Would I put my critical section around my char array before I make my call to AfxBeginThread, or do it in my thread around the myDlg->sText char array.
2. Would it be wise to have another char array in my thread that I move this data off to and release my critical section?
Sorry I forgot a question.....If I create a char array in my thread does it have it own unique memory space each time a thread is created?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
1. You need to protect a string at the time the string is accessed.
If you really want to display the messagebox, I would make a local copy, but protect the copy process with the critical section.
UINT CLAQTermDlg::MyIOThread(LPVOID pParam )
{
CLAQTermDlg * myDlg = (CLAQTermDlg *)pParam;
CString csMessage;
EnterCriticalSection(...);
csMessage = myDlg->sText;
LeaveCriticalSection(...);
::MessageBox(NULL, csMessage, "In my Thread", MB_OK );
return 0; //Thread completed successfully
}
2. If you need the data longer, then make a variable as part of your thread class or a local variable in the thread function, and perform a protected copy, similar to above example. You also need to use same critical section in other parts of your code wherever the myDlg->sText is modified or accessed.
3. The array would be unique if it is local to the thread function or else if it is a member variable of a derived thread class, since you would be creating an instance of the thread class for each thread which is run. Just don't declare the member variable as static or it is shared among all instances of a class.
|
|
|
|
|
I'm trying to write a program that is based off of data from a database program. The only problem is, I want data from the database program that is only available if I print it to the printer. However, I can choose the 'print to file' option and the information is put in a .prn file. My question, then, is does anybody know how to read from a .prn file in C++? Some characters may be readable, but others are junk.
Danny
|
|
|
|