|
Blake Miller wrote: FindWindow
DAMM, FindWindow again!
"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
|
|
|
|
|
elephantstar wrote: Is there a simple way of checking to see if an external application,
look for Process32First and Process32Next apis
"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
|
|
|
|
|
Thanks, that worked. I also have another question. I was planning on using AttachThreadInput() to bring the application to the front but I wasn't sure how to obtain the thread id. Any help is much appreciated. Thanks.
|
|
|
|
|
elephantstar wrote: was planning on using AttachThreadInput() to bring the application to the front
Any particular reason for using it !
"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
|
|
|
|
|
elephantstar wrote: I was planning on using AttachThreadInput() to bring the application to the front
any particular reason to use that api..... anyway use CreateToolhelp32Snapshot with TH32CS_SNAPTHREAD to get thread list associated with it.
"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
|
|
|
|
|
elephantstar wrote: I was planning on using AttachThreadInput() to bring the application to the front
any particular reason for using it,anyway use CreateToolhelp32Snapshot with TH32CS_SNAPTHREAD to get list of thread
"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
|
|
|
|
|
I'm using Visual Studio 2005. I'm trying to create a dynamic library for my MFC application. This library uses MFC via shared DLL and exports a class that contains functions using CString objects.
For example, I constructed a simplified library like so:
<code>#ifdef TEST_EXPORTS
#define TEST_API __declspec(dllexport)
#else
#define TEST_API __declspec(dllimport)
#endif
class TEST_API CTest {
public:
CString DoStuff()
{
return _T("This is only a test.");
}
};
Simple enough, right? But whenever I try to link my application to this library and use the CString-related function, I get linker errors like the following:
error LNK2019: unresolved external symbol "__declspec(dllimport) public: class ATL::CStringT<unsigned short,class ATL::StrTraitATL<unsigned short,class ATL::ChTraitsCRT<unsigned short> > > __thiscall CTestClass::DoStuff(void)" (__imp_?DoStuff@CTestClass@@QAE?AV?$CStringT@GV?$StrTraitATL@GV?$ChTraitsCRT@G@ATL@@@ATL@@@ATL@@XZ) referenced in function ....
I came across this article on Codeproject, wherein Nick Pirocanac recommends using CAtlString in the library instead of CString, but it was writen for Visual C++ 7, and it seemed to be addressing problems with ATL-based libraries and applications. I tried Nick's methods anyway, and they didn't seem to work.
I just recently migrated to Visual Studio 2005 from version 6, and of course this library worked just fine back then, before CString was template-ized. Now, the strange thing is that this problem doesn't seem to occur when I do a Release build. I scanned through the configurations, but I'm fairly new to VS8 and I couldn't find any difference between the configurations that would cause this.
Has anyone had similar problems, and more importantly, does anyone know how to fix this? I get the feeling it's something simple and obvious that will make me feel very stupid when it's explained, but I just have no clue right now. Any help would be most appreciated.
[Insert witty and relevant signature here]
|
|
|
|
|
I was going through the project options again and I found the culprit. Apparently I had turned off the "recognize wchar_t as a native type" option at some point in my MFC application. And all this time I'd been thinking it was MFC's / ATL's fault. I'm such a dummy sometimes. :P
[Insert witty and relevant signature here]
|
|
|
|
|
Mr. Accident wrote: I'm such a dummy sometimes.
Not at all. You continued to work on the problem, and when you found the answer, posted the solution here. Others can then benefit.
Software Zen: delete this; // <a href="http://www.codeproject.com/script/profile/whos_who.asp?msg=1307432&id=10338#xx1307432xx" rel="nofollow">Fold With Us!</a>[<a href="http://www.codeproject.com/script/profile/whos_who.asp?msg=1307432&id=10338#xx1307432xx" target="_blank" rel="nofollow" title="New Window">^</a>]
|
|
|
|
|
LOL thanks buddy. I was searching for this. He he.
Thanks.
Mr. Accident wrote: I'm such a dummy sometimes
Me too.;P
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
For example:
1> I want to use the application C:\aaa\myzip.exe to open the file C:\abc\a.zip ;
2> I want to use the application that is automatically associated with the all .html files to directly open the file C:\abc\b.html ;
How to use CreateProcess to complete the two tasks above? Thanks!
-- modified at 11:53 Friday 23rd December, 2005
|
|
|
|
|
1. Wrap your paths in quotes (not that you need it specifically for this example, but it's good practice for space-containing paths) and escape your slashes (or use the / method):
STARTUPINFO oStartupInfo;
PROCESS_INFORMATION oProcessInfo;
LPSTR szCmdLine = "\"C:\\aaa\\myzip.exe\" \"C:\\abc\\a.zip\"";
memset(&oStartupInfo, 0, sizeof(STARTUPINFO));
memset(&oProcessInfo, 0, sizeof(PROCESS_INFORMATION));
oStartupInfo.cb = sizeof(STARTUPINFO);
if (CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE,
0, NULL, NULL, &oStartupInfo, &oProcessInfo))
{
WaitForSingleObject(oProcessInfo.hProcess, INFINITE);
CloseHandle(oProcessInfo.hProcess);
CloseHandle(oProcessInfo.hThread);
}
else
{
TRACE("Could not open the process. Error: %u\n", GetLastError());
}
2. Don't. Use the significantly easier method:
ShellExecute(NULL, "open", "file://C:\\abc\\b.html", NULL, NULL, SW_SHOWDEFAULT);
--
I've killed again, haven't I?
|
|
|
|
|
|
Hi to you all,
please help me. I'm looking for a method, to get fully access to a network-drive. It should be like it's done by the OpenFileDlg.
Thank's!
M.C.
Meinhard
|
|
|
|
|
Can a C++ shell.DLL do a drop into an application that has drag-drop enabled? If yes, then does it make sense to search for the window handle to see if the app is running, if not start it with shell execute, then do the drop? Got any code or references somewhere?
Thanks,
DD
|
|
|
|
|
I have created a console application using straight WIN32 api in 'C'. When the user runs it I don't want it to show up...anywhere. Is there a way to specify that I don't want it to appear as a window?
I know you can do this with CreateProcess(), but I'm not spawning a process from another one. I'm running IT directly...?
For those wondering why the heck I want to do this; I'm writing a launcher application that, when a user clicks on a file with particular extension, this program will run (it will be registered with that filetype), figure out what version of our software to run, find it, then spawn the main application with the clicked on file as an argument. Then it will quit. So, we don't want to the user to see any of this "behind-the-scenes" work.
Thanks!
|
|
|
|
|
AFAIK console apps will always create the console. What I do when I want an app to run hidden the way you do is to create a windows app but do not create a window. Create a new win32 windows app, transfer all your code over to it renaming your main function to winmain . You also have to change the winmain parameters.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
From the description of your needs, the launcher should be a GUI app, not a console app. The app can do all the work in WinMain() and never create any windows.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
Thanks guys; this was the solution I was looking for. The other options showed the console window briefly; which was still undesirable. Thanks!
|
|
|
|
|
How about try this?
Q124103: "HOWTO: Obtain a Console Window Handle (HWND)"
and then in the main(), do a ShowWindow(SW_HIDE);
#include <windows.h>
#include <stdio.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
HWND hwndFound; // This is what is returned to the caller.
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated
// WindowTitle.
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original
// WindowTitle.
// Fetch current window title.
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
// Format a "unique" NewWindowTitle.
wsprintf(pszNewWindowTitle,"%d/%d",
GetTickCount(),
GetCurrentProcessId());
// Change current window title.
SetConsoleTitle(pszNewWindowTitle);
// Ensure window title has been updated.
Sleep(40);
// Look for NewWindowTitle.
hwndFound=FindWindow(NULL, pszNewWindowTitle);
// Restore original window title.
SetConsoleTitle(pszOldWindowTitle);
return(hwndFound);
}
main()
{
ShowWindow(GetConsoleHwnd() , SW_HIDE);
while(1)
Sleep(10000);
}
Vipin Aravind - MVP
|
|
|
|
|
See this...
http://www.codeproject.com/win32/runsilent.asp[^]
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Hello,
I want to monitor the volume of my sound. I don't
ask for a complete analyzer, I just want to measure
the "amount of loudness".
Any ideas?
Thank you in advance,
Mat.
|
|
|
|
|
How can i add color to buttons in the dialog box
Thank u in advance
|
|
|
|
|
HI ,
you need to make ownerdraw buttons and capture the WM_DRAWITEM Were you can set the SetBkColor() etc ........
Regards
FarPointer
|
|
|
|
|
Hi,
I call this function: SetBkColor(RGB(255,255,255)); in WM_DRAWITEM , But i dont find the result.
Plz help me.
Thank u
|
|
|
|