|
rwe1812 wrote: Might it be worthwhile to publish an article about this here on codeproject?
Definitely - it sounds like something that a) could trip up other people, and b) isn't documented as clearly as it could be.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I am opening an application through another application using CreateProcess().
If the exe is running already I am sending a message through PostMessage otherwise I am opening run the exe and send message.
I found the running instance using FindWindow(). But some times FindWindow() is returning " NON-NULL" although app is not running.
I am confused with this behavior.
My Window Caption is "DDKK";
And My code to FindWindow() is:
HWND hWindow=NULL;
hWindow=::FindWindow(NULL,_T("DDKK"));
if(hWindow==NULL)
{
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
CreateProcess (CSanProApp::GetAppPath(0) + _T("abc.exe"),
_T(" und"),NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
Sleep(4000);
}
::PostMessage(hWindow,Opendialog,0,0);
Please suggest me any solution, why the FindWindow() is returning NON-NULL value although window is not running.
|
|
|
|
|
Check out EnumProcesses to find if a process is running
You can also use OpenProcess, if it returns NULL process is not running etc etc.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
MPTP wrote: ...although app is not running.
How are you verifying this?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
FindowWindow() takes 2 parameter: classname, windowname....
Is there any method to register window with desired name.
My app using below code to register window
<br />
if( !CFrameWnd::PreCreateWindow(cs) )<br />
return FALSE;<br />
<br />
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;<br />
cs.lpszClass = AfxRegisterWndClass(NULL,NULL,NULL,AfxGetApp()->LoadIcon(IDR_MAINFRAME));<br />
<br />
cs.style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;<br />
return TRUE;<br />
|
|
|
|
|
MPTP wrote: Is there any method to register window with desired name.
Yes, but that does not answer my question. When FindWindow() returns a non-NULL window handle, how are you verifying that the application is not running?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Just to see the exe name in Task Manager
|
|
|
|
|
MPTP wrote: ...in Task Manager
Which tab?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
FindowWindow() takes 2 parameter: classname, windowname....
Is there any method to register window with desired name.
My app using below code to register window
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
cs.lpszClass = AfxRegisterWndClass(NULL,NULL,NULL,AfxGetApp()->LoadIcon(IDR_MAINFRAME));
cs.style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
return TRUE;
|
|
|
|
|
what an application wizard will do for a application?
who will create APPclass and Dialog Class for a application.
Are all controls are classes as that of VB.net controls.
|
|
|
|
|
munigantipravin wrote: what an application wizard will do for a application?
based on the type of application the files get generated and the editor is responsible for this.
once you select a console application depending upon your choice you get an empty project or cpp/h and stdafx's files
munigantipravin wrote: who will create APPclass and Dialog Class for a application.
the wizard will
munigantipravin wrote: Are all controls are classes as that of VB.net controls.
yes.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
HEllo All,
Can you please tell me ,can i exports data in dll .If i want to use that data in c# application.
e.g.:-
my dll file contain one class Demo{public int d;}
& i want to use that class Demo in my .cs file how should i use it.
Thank You.
|
|
|
|
|
I suggested you to write a RunTimeCallable Wrapper the last time you asked the same thing.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Can you please help me how to use it
|
|
|
|
|
you will have to create a wrapper over your win32 dll in case of RCW. Call the methods of this win32 dll using a COM object.
After that you can use tlbimp to generate the type lib.
and this can be used in C#
Read here[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi All,
Can someone point me in the right direction? This is a reference to the article: "Synchronized multi-threading in C++ (No MFC!)"
Synchronized multi-threading in C++ (No MFC!)
I have been using the thread code and it worked well for me. But this time around, nothing has changed and it returns an unhandled exception on "thread::wait", line "return false" when "wait("MyMutex")" is called during a receive from a worker thread.
unhandled exception in kernel32 (0xE06D7363) on Thread::wait ( line "return false")
Thread::wait(const char * 0x004768e8 `string', long 0x00001388)
Thanks for your help.
Code Section
bool Thread::wait(const char* m,long ms) {
HANDLE h = OpenMutex(MUTEX_ALL_ACCESS,FALSE,m);
if(h == NULL) {
throw ThreadException("Mutex not found");
}
DWORD d = WaitForSingleObject(h,ms);
switch(d) {
case WAIT_ABANDONED:
throw ThreadException("Mutex not signaled");
break;
case WAIT_OBJECT_0:
return true;
case WAIT_TIMEOUT:
throw ThreadException("Wait timed out");
break;
}
return false;
}
modified on Friday, May 8, 2009 8:49 AM
|
|
|
|
|
Hello All,
I need to highlight the one of TAB of Tab Control. but TabCtrl_HighlightItem() is not working for me.
Thank You in Advance.
|
|
|
|
|
Sure you don't mean select it, as with TabCtrl_SetCurSel[^]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank You 4 Reply my Question.
Yes, i don't want to Select the Tab but only highlight the one of the TAB to indicate that some think is new in that Highlighted TAB.
|
|
|
|
|
zakkas2483 wrote: ...to indicate that some think is new in that Highlighted TAB.
Assuming that TabCtrl_HighlightItem() indeed does not work, how about changing its caption (by appending a '*' character)?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
OK - I see. So...how is TabCtrl_HighlightItem not working for you?
I've added a tab control to a sample project I have> It's MFC, but I've used the TabCtrl_HighlightItem macro to highlight items. Here's the method I have - it reacts to an edit control changing and cycles through the tabs of the control (the current tab index is in tabIdx_), toggling the highlight state.
void CaaaDlg::OnEnChangeEdit1()
{
tabIdx_++;
tabIdx_%=(TabCtrl_GetItemCount(tabs_.m_hWnd));
bool isHighlighted = TCIS_HIGHLIGHTED == tabs_.GetItemState(tabIdx_, TCIS_HIGHLIGHTED);
TabCtrl_HighlightItem(tabs_.m_hWnd, tabIdx_, isHighlighted?FALSE:TRUE);
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hi all,
i have an application in which i have some images in a folder and i need to display these into a List control using imagelist.
i need to display it in a mannner that when the firsttime it read image from a folder then it should first image and should display in list control. and at second time it should read secondimage and add this image in list control and display it in list control and so on.
i dont have any idea how to do it please send a demo project so that i can do it easily
thanking you
|
|
|
|
|
See Thumbnails Viewer using ListCtrl [^].
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi,
I am running a flash activeX in a window in which DirectX is rendering. As DX is drawing on top of flash, it creates a flickering effect where flash is placed (first flash and then DX draw the same area).
As this is a 3D game, ideally I would like to be able to switch between flash and DX seamlessly. So I am able to open and close flash during the game with the same 3d world in the background.
The different options I have tried to allow flash and DX to co-exist:
1. Turning off DX rendering during flash's rendering. This stops 3D rendering and only flash is displayed.
2. Creating a hidden child window and attach flash activeX to that window. Then copying flash's frame using OleDraw on DX surface. Frames are copied fine but the issue here is that flash does not receive windows messages and activeX stops running.
3. Creating a separate pop-up window with flash running inside. This runs fine but flash window is separate from my 3d world.
Unfortunately it seems there is no way to tell flash activeX when to render its frame (maybe WM_PAINT?). Running flash in a hidden window and copying frames is something that gives more options in terms of flash's usage inside the game.
Any ideas on how to achieve seamless flash and DX rendering?
Regards,
Hasan
|
|
|
|