|
You should try these: WM_XBUTTONDOWN and related window messages, WM_INPUT window message, directinput, and here is a hack on codeproject that might come handy: How to use your extra mouse buttons in games or apps[^]. Note: I havent used WM_XBUTTON messages and used WM_INPUT only to get mouse movement delta instead of mouse pos but trying these isnt a big waste of time.
|
|
|
|
|
Hi all,
i am writing a program that opens an explorer window, when CreateProcess open new window the main program must be minimized when i will close Explorer.exe i want that program return in SW_SHOW state.
I simply need to detect when Explorer.exe will be Close.
I have seen that when i use createprocess with microsoft MSDN example it will check only one time.
What i have to do to complete my task please help me
|
|
|
|
|
It is possible to wait for a program to exit when you start it with CreateProcess() but in your case you shouldn't do that. Many text editor and browser and whatever programs work like this: They allow you to open many documents on tabs. When you use CreateProcess() to start the editing or viewing of a document (or a webpage in your case) you launch an instance of the editor program that does the following: It checks if another instance of that program is already running and if that is the case then the process you created is just passing some info to the already running process and the process you started exits immediately. The already running process shows your document/webpage on a new tab. You shouldn't check for closing the explorer because you can't for the reasons I listed previously, moreover, I know that many users never exit their web browser - they use it open all they with hundreds of tabs for some reason.
|
|
|
|
|
You can wait on a process handle:
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
BOOL bOk = CreateProcess(
_T("C:\\Windows\\system32\\notepad.exe"),
NULL,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi
);
if (bOk)
{
CloseHandle(pi.hThread);
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
MessageBox(NULL, _T("Finished"), _T("Create and wait"), MB_OK);
}
Steve
|
|
|
|
|
Thanks for ask
I have tried your solution and it goes good when i need to close my opened app,
but i need this:
i want open an explorer.exe window and when i close my caller program i need that program closes explorer window too.
Do you think it's possible?
|
|
|
|
|
Now I'm using VC++ 2010, but the
syntax_option_type of VC++ 2010 only contains the following options:
static const flag_type icase = regex_constants::icase;
static const flag_type nosubs = regex_constants::nosubs;
static const flag_type optimize = regex_constants::optimize;
static const flag_type collate = regex_constants::collate;
static const flag_type ECMAScript = regex_constants::ECMAScript;
static const flag_type basic = regex_constants::basic;
static const flag_type extended = regex_constants::extended;
static const flag_type awk = regex_constants::awk;
static const flag_type grep = regex_constants::grep;
static const flag_type egrep = regex_constants::egrep;
It doesn't contain
perl_syntax_group (Boost Library has the option). However, I don't want to use the Boost Library.
There are many regular expression written in Perl, So I want to convert the existing Perl regular expressions to
ECMAScript (or any one that VC++ 2010 support). After conversion I can use the equivalent regular expressions directly in VC++ 2010 without using the third party libray.
One example:
const boost::tregex e(__T("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z"));
const CString human_format = __T("$1-$2-$3-$4");
CString human_readable_card_number(const CString& s)
{
return boost::regex_replace(s, e, human_format);
}
CString credit_card_number = "1234567887654321";
credit_card_number = human_readable_card_number(credit_card_number);
assert(credit_card_number == "1234-5678-8765-4321");
In the above example, what I want to do is convert e and format to ECMAScript style expressions.
ECMA Script regex is a subset of Perl regex, if I don't use the features exclusive to Perl regex.
Is it possible to find a general way to convert all Perl regular expressions to
ECMAScript style? Are there some tools to do this?
Any help will be appreciated!
|
|
|
|
|
I'm having a very strange problem with a third party dll. When I try to use this dll in my program an exception is thrown even before WinMain is called, yet other programs use it without any problems.
Eventually, I narrowed it down. If any program uses the dll and also calls a certain Windows function (for example SHGetSpecialFolderPath, or timeGetTime) then the the exception happens.
This problems seems really bizarre to me. Does anyone know what could be causing it?
|
|
|
|
|
You stated that the exception is thrown before your WinMain(). Statically linked dlls are loaded by windows for your executables and DLLs. The DllMain() of statically linked DLLs execute eralier than the main of the module (dll or exe) that actually uses the DLL. I would suspect that something is screwed up in your 3rd party DLL and it might be sensitive to DLL loading order. If you exe uses SHGetSpecialFolderPath() from shell32.dll and the 3rd party library also uses a function from shell.dll then the loading of shell32.dll might happen before or after the loading of your 3rd party depending on whether your program loads shell32.dll or the 3rd party first. However this whole situation seems to be totally screwed up for me. Try to set a breakpoint on "module load" events and debug the loading order of your DLLs, maybe you find out something useful. Try to search for the exception code too in google.
|
|
|
|
|
Post a call stack. Always post a call stack!
Steve
|
|
|
|
|
Ok:
> ntdll.dll!7c967406()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!7c940e5a()
ntdll.dll!7c918790()
ntdll.dll!7c90e457()
libGLESv2.dll!00360062()
I doubt if that's any use though
|
|
|
|
|
The one useful bit is the last line that suggests the problem started in libGLESv2.dll. Assuming this is the 3rd party library you should contact the author(s) for help.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Yeah, I already contacted them, but no answer. I think I'm just going to give up and use an alterate library.
|
|
|
|
|
Use a symbol server when getting a stack trace.
Steve
|
|
|
|
|
ed welch wrote: yet other programs use it without any problems.
That suggests along with your other responses that something about the build, rather than usage, is different.
There are different ways of setting up the runtime environment based on linker options.
|
|
|
|
|
no, I comfirmed that it's not any compile or link option
|
|
|
|
|
hi !!!!! in my project am going to use prediction algorithm for predicting the rail track allocation for incoming trains in a station.. any one please help in finding the algorithm or the
C code .
|
|
|
|
|
Without knowing what the algorithm is it's a bit difficult to guess what the C code is. You say that you are going to use this algorithm so maybe you could provide details.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
|
Google is your friend. Moreover, we have a 'Algorithms' forum here at CodeProject .
Veni, vidi, vici.
|
|
|
|
|
How about reading the time table? I've found it to be surprisingly efficient at predicting what track each train would be incoming at.
Seriously:
1. go to the 'algorithms' sub forum. Until you have an algorithm, there is no C/C++ question to solve.
2. specify precisely the input you have and the output you want. Without that information it is impossible to find an algorithm. For all I know now, my answer above may in fact be sufficient (although I doubt it)
3. use the internet search engine of your choice and search for similar projects. You probably won't find exactly what you need, but if you see something similar, you can try and adapt it to your project, or ask for help in doing so.
|
|
|
|
|
Hi,
I have a dialog box. I have 10 buttons on that dialog box. I am using CSkinButton class to use images for those buttons. I want to provide scrollbar to the dialog box dynamically. For example, if I use 6 buttons, will fit the size of the dialog box. If I want to use 10 buttons, then vertical and horizontal scroll bar should appear on the dialog box automatically. As I using Images (Bitmaps) for buttons, scroll bar doesn't appear automatically.
I have tried to set the property of the dialog box for scroll bar. It doesn't work.
Anybody have anny idea regarding this.?
Please let me know if you have any doubt in understanding the above questions.
Regards,
Mbatra
|
|
|
|
|
This should be a good start.[^]
Can I advise you to re-think your UI to not have to have scrollbars AT ALL ? It is quite counter-intuitive for users to have to scroll in a dialog to be able to see buttons.
Max,
Watched code never compiles.
|
|
|
|
|
Hi,
I want to create an MFC MDI Application, which is used to draw engineering 2D drawing. A similar one to Auto CAD 2D software.
Can anyone of you suggest us the best open source library which we can use to implement 2D mfc drawings.
I know some of libraries like OpenGL, DirectX but i am not sure a) whether we can use these libraries to create 2D drawings. b) whether we need to purchase these libraries as we are developing a commercial application. c) there may be better libraries available for 2D drawing and it may be for free.
Thanks,
Regards
Maha
|
|
|
|
|
OpenS-CAD, a simple 2D CAD application [here].
2D Drawing - Doc/View architecture [here].
CadLib for creating DXF(Drawing Interchange Format) files [here].
|
|
|
|
|
We have in many places in our code things like :
(pseudo-code)
if ( string.compare(A) == 0 )
{
}
else if ( string.compare(B) == 0 )
{
}
else if (string.compare(C) == 0 )
{
}
else if (....)
{
}
else
{
}
I know that we cannot use switch cases for strings, but is there a better way to do cascading If comparisons on strings ?
(This is not urgent ).
Thanks.
Max.
Watched code never compiles.
|
|
|
|