|
Hi,
The WM_QUIT message is not associated with a window and therefore will never be received through a window's window procedure.
The WM_CLOSE message is sent as a signal that a window or an application should terminate.
Do not post the WM_QUIT message using the PostMessage function; use PostQuitMessage.
Bye
Cool Ju
Dream Ur Destiny
|
|
|
|
|
Cool Ju wrote: Do not post the WM_QUIT message using the PostMessage function; use PostQuitMessage.
In context on original problem posted by User,Sorry for correcting you.. You cannot use PostQuitMessage to terminate/close other process .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I should have posted my comment clearly. Thanks for correcting it.
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
I did a project in VC++ 6.0 in windows XP but when I run the same exe in windows 98, the default font type and size of the modal dialog box changes. (The font in the caption bar of the main frame and child frame is the default) Wut is the problem? Should i give default font type and size in DoModal() function?
|
|
|
|
|
In Window XP if a Window function has a string argument,it manipulates or handles the string as Unicode (even if the code is not compiled as unicode).This is not in Window 98
|
|
|
|
|
sunit5 wrote: In Window XP if a Window function has a string argument,it manipulates or handles the string as Unicode (even if the code is not compiled as unicode).This is not in Window 98
You are right in windows XP, the string args are treated as unicode wheather it unicode or not (internally). But little correction you Sir!.. users problem is not related with UNICODE.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Arrun wrote: Wut is the problem? Should i give default font type and size in DoModal() function?
That’s the common Problem.. As Font Setting is different for different computer /OS + User can easily change it (By applying new theme, changing display setting etc) .. It is always good to set your own default font when designing software...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I am trying retrieve summary information of the file.
I was using stgOpenStorage API. My code is working only for Word documents and text files.
I need this for mpeg,jpeg & wmv files.
The following is the code i am using.
try
{
hr = StgOpenStorageEx( L"D:\\Photos\\daffs-768.jpg",
STGM_READ|STGM_SHARE_DENY_WRITE ,
STGFMT_ANY,
0, NULL, NULL,
IID_IPropertySetStorage,
reinterpret_cast<void**>(&pPropSetStg) );
if( FAILED(hr) )
throw L"Failed StgOpenStorageEx";
IUnknown *pUnk = NULL;
hr = pPropSetStg->QueryInterface (IID_IUnknown,(void**)&pUnk);
hr = pPropSetStg->Open( FMTID_SummaryInformation, STGM_READ | STGM_SHARE_EXCLUSIVE,
&pPropStg );
if( FAILED(hr) )
throw L"Failed IPropertySetStorage::Open";
// Read the property back and validate it
hr = pPropStg->ReadMultiple( 1, &propspec, &propvarRead );
if( FAILED(hr) )
throw L"Failed IPropertyStorage::ReadMultiple";
if( S_FALSE == hr )
throw L"Property didn't exist after reopening the property set";
else
{
int len = strlen(propvarRead.pszVal);
WCHAR* data = new WCHAR[len];
mbstowcs(data,propvarRead.pszVal,len);
wprintf(data);
delete data;
}
}
catch( const WCHAR *pwszError )
{
wprintf( L"Error: %s (hr=%08x)\n", pwszError, hr );
}
Please help me how to do this.
|
|
|
|
|
What can be issue of using EVENTS object for single instance application for single user on a desktop.
I have seen this method given in the link, which is quite clean solution to the problem but using mutex and then boradcasting message is bit concern.
http://www.codeproject.com/threads/simplesingleinstanceapp.asp[^]
Here is what I inted to do when using events for process communication.
step1:
Create an unique event in the ininstance method in Reset mode.
Check if event is already created.
If event not created then create event and create screenControl thread to listen for set/reset of that event.
If event is there then means window is already present and hence
set the event here so that running thread can wakeup.
// OnlyOne.cpp
// global data
HANDLE hEvent;
int ShutDownFlag;
void ScreenMonitor(LPVOID pParam);
// COnlyOneApp initialization
BOOL COnlyOneApp::InitInstance()
{
///// other stuff...
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(COnlyOneDoc),
RUNTIME_CLASS(CMainFrame), RUNTIME_CLASS(COnlyOneView));
AddDocTemplate(pDocTemplate);
//------
hEvent = CreateEvent(NULL,TRUE,FALSE,_T("ONLYONE-APP"));
AlreadyRunning = ( ::GetLastError() == ERROR_ALREADY_EXISTS || ::GetLastError() == ERROR_ACCESS_DENIED);
if (AlreadyRunning) {
MessageBox(NULL,"Already Running....","Message!!",MB_OK);
SetEvent(hEvent);
return TRUE;
}
//-------
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
//--------
CWinThread *wndThread = AfxBeginThread((AFX_THREADPROC)ScreenMonitor, m_pMainWnd->GetSafeHwnd(),THREAD_PRIORITY_NORMAL,0,0);
if (wndThread == NULL)
{
MessageBox(NULL,"Could not Create Thread...","MSG",MB_OK);
return FALSE;
}
//-------
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
step 2:
Thread method. This method waits for events to set. When event is set which signifies same application tried to start, this thread brings first instance in the foreground.
// COnlyOneApp message handlers
void ScreenMonitor(LPVOID pParam)
{
CWnd* wnd;
while(ShutDownFlag)
{
WaitForSingleObject (hEvent, INFINITE);
wnd = CWnd::FromHandlePermanent(static_cast<hwnd>(pParam));
if (wnd->IsIconic())
wnd->ShowWindow(SW_RESTORE);
wnd->SetForegroundWindow();
ResetEvent(hEvent);
}
}
It works fine. But I am worried about issues which I am not able to think like race condition,Uniqe event in system or higher speed system with single click execution.
Please let me know your concern.
regards,
-OP
Who lets the coder out...
|
|
|
|
|
Hi all,
I have used some of the synch objects in my code. At times I tried using more that one for same purpose, and both works fine..
Many books, docs explain about the synch objects..But I couldn't find about the analysis of When to use what kind of sych objects in detail..
Can someone who has a solid understanding on this can share their thoughts on this..or can give some pointers on When to use what synch objects..
Thanks,
|
|
|
|
|
|
Thanks Anyway..
But this discusses what each synch object is..
I am looking for info on distinguistion between each and other object with respect to a sample situation..
Let me know if you have more info on this..
Thanks,
|
|
|
|
|
A general compare of all sync object types would take a bit of space ... and then likely be incomplete.
Do you have specific cases ?
e.g. critical section vs mutex in a situation where ...
...cmk
Save the whales - collect the whole set
|
|
|
|
|
As cmk mentioned, you should list certain situations and scenarios. You mentioned that you've used different sync objects in the same situtation, and they all worked fine. What situation and which objects?
Bob Ciora
|
|
|
|
|
I am using a multiple desktops software and am seeing that the dr watson popup always comes on the primary windows desktop and not in the currently active desktop. Does anyone know why this is so?
thanks!
|
|
|
|
|
Sorry this is not an answer to your question.
Since you are using Dr Watson for your application. Do you know any good advanced online article/document on the same.
|
|
|
|
|
Hello,
Based on a CComboBox control selection, I want to load CPropertySheet into a dialog-based MFC Application. I have 3 CPropertySheets in my project.
Inorder to do this, based on event :OnCbnSelchangeComboBox(), I want to delete existing CPropertySheet control and load the selected one.
How can I do this? Do I have to delete each & every CPropertyPage page and then add new CPropertyPage pages?
Is there any way that deletes total CPropertySheet once?
Regards,
mysticlol
|
|
|
|
|
Why don't you try showing the needed sheet, and hiding the not needed ones.
Like:
when sheet1 is needed:
m_Sheet1.ShowWindow(SW_SHOW);<br />
m_Sheet2.ShowWindow(SW_HIDE);<br />
m_Sheet3.ShowWindow(SW_HIDE);
Similarly show / hide them when needed.
this is this.
|
|
|
|
|
Hi All....
FindWindow() fails, even if instance of that application is running. When the first instance of the application runs, windows title is set.
Next time around, if I try to find the window using same string, it returns NULL. GetLastError() returns me ERROR_SUCCESS-0 code.
Can anyone explain Reason for this?
Suraj Gupta
|
|
|
|
|
|
Thanks for the help..But the case in which I am facing this problem is not race condition.
Suraj Gupta
|
|
|
|
|
i want to know about Windows ACL with sample code . can anyone help me .
|
|
|
|
|
gpswamy wrote: i want to know about Windows ACL with sample code .
If you could be a little precise, you will get the problem solved by someone out here. The narrower your question is, the clearer people can answer.
1. What do you want to know about ACL?
2. What source code?
3. How exactly are you going to use it?
4. What exactly are you going to do with ACL?
However, this[^] might help you.
gpswamy wrote: can anyone help me
There are 2,499,728 members as of now. Someone will help you, if you could ask your question precisely.
Regards,
Rajesh R. Subramanian.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Subramanian.
Thatas a nice quote
"
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
"
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
A very good article on ACL.
|
|
|
|