|
MSDN, as per Elaine's reply above, is probably the best starting point, especially here[^], but a bit closer to home, you could also try this article [^]or this one[^].
|
|
|
|
|
Im trying to find a good way to minimize a game(full screen) when I press a key combination like alt + tab, but it needs to workin in windoes xp. I can't seem to find an appropriate function to use for this. any suggestions?
|
|
|
|
|
You can use GetAsyncKeyState() or GetKeyState() to test for th keys
then you can GetTopWindow() or GetActiveWindow() something like that i dont remember which it is
to get a handle to the active window,
and then call CloseWindow() (it doesnt actually close it it just minimizes it)
if you need help with it just let me know, it shouldnt take me a few minutes to write the whole thing
|
|
|
|
|
Ok well im getting somewhere but not quite doing what i need. Here is what im trying to do:
Build a simple app the runs in the background while I play a full screen game. The game does not have an minimize ability. So I want to have my app minimize the game when I press Ctrl+Z.
So far I have been able to get it to work (sort of) but only for windows and not the full screen game that I want to minimize. I'm using GetAsyncKeyState() to test the keys and GetForegroundWindow() to get the handle to the active window then just use CloseWindow() to minimize. But this does not seem to work for full screen apps. Any suggestions?
Thanks for the help.
|
|
|
|
|
Well, you could also use ShowWindow() to hide and show it,
here is what i would do
in the main thread set a HWND variable to 0 by default, continously loop and test for CTRL+Z
if CTRL+Z is pressed and the variable is 0, then call GetForegroundWindow() and store its hwnd in the variable, and hide the window
if the variable is not empty then show the window and set the variable back to 0
|
|
|
|
|
HI~
I would like to ask
How do I change the data in C++ dll by a C# program?
I have ever tried this.
I wrote a dll with VC++. There is a variable in the dll (e.g "m_string"). "m_string" is a LPCTSTR type and it's inital value set by constructor is _T("Hello World"). I also wrote a function for setting the variable. The function is declared like this:
extern "C" _declspec(dllexport) void set(LPCTSTR s)
{
m_string = s;
}
Afterward, I wrote a C# dll assembly. The C# dll import the dll written by C++. The import the dll like this:
#region DLLImports
[DllImport("Test.dll")] //test is the C++ dll filename
private static extern void Set(string s);
#endregion
Finally, I wrote a form to call the method "Set". After the method have finished executing, the value "m_string" does not change. The "m_string" is still "Hello World".
My question is, how to change a variable in dll permanently by a C# library or exe?
Thanks
|
|
|
|
|
I want to creat a SubDialog dynamically,but not use the method of importing a dialog in the resource,what should I do?
Thanks a lot
|
|
|
|
|
|
I have a custom control which I want to be able to recieve input from the keyboard. I planned to accomplish this by processing the WM_KEYDOWN message, but I've been having some problems. First of all, most of the keys trigger a beep sound when they're pressed like the window is refusing them, although they still trigger a WM_KEYDOWN and get proccessed properly. Second, a few keys (such as the arrow keys) don't trigger a WM_KEYDOWN, or do anything at all for that manner. This problem only shows up when the control window is created as a child, when I create it as an independant window there is no problem. If np one can solve this problem I suppose I can program the window manually to behave as a child, but there's gotta be a better solution, right?
|
|
|
|
|
You might want to handle the WM_GETDLGCODE -message in your custom control. Return DLGC_WANTALLKEYS and see if it helps. Note that the tab-key will also be routed to the child, and that you might want to experiment with a combination of returns. MSDN has the list of possible values.
|
|
|
|
|
Thanks, that worked perfectly. I would've thought something like this would come up fairly often, but I asked tons of places and this is the first I got an anwser from.
|
|
|
|
|
Custom controls is a pretty advanced area. You were just lucky asking when an old SDK-developer was at hand
|
|
|
|
|
Take for example the following code
<br />
CItemInfo *lp = new CItemInfo()<br />
lp->SetItemText("String");<br />
CTreeItem *pParent = pList->InsertRootItem(lp);<br />
delete lp;<br />
the following is for inserting data into a TreeList control.
the problem here is that the command delete lp will delete the information stored in the treelist. If I change lp from heap to stack, I get the same result. If I remove delete lp then the information stays.
Is there a way I can prevent this kind of occurance? I would like to clean up my pointers if possible but that seems to corrupt existing data.
Thanks!
|
|
|
|
|
Is this code within a class's member function?
Happy Programming and God Bless!
"Your coding practices might be buggy, but your code is always right."
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
See if your TreeList can associate an LPARAM with each item, like regular trees and lists do. If so, put the pointer in each item's LPARAM . Then when the items are removed from the control (TVN_DELETEITEM for trees, LVN_DELETEITEM for lists) delete the pointer then.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
I even hear the Windows "OMG I booted up fine" sound.
-- Paul Watson diagnosing hardware problems.
|
|
|
|
|
I guess there is not. The CTreeItem only stores the pointers you give him, not the actual data. So if you delete the data, the pointer the CTreeItem has is useless. Why don't you just delete them once you stop using the CTreeItem?
(I have never worked with MFC etc, but this is a common practice)
|
|
|
|
|
Thanks for the tips, guys. I'll try looking in that direction!
|
|
|
|
|
I am using SetDeviceGammaRamp and it is working fine for my nVidia CRT monitors running Windows 2000.
On the Tablet and Panel PC running Windows XP - Nothing happens.
Anyone got some clues?
|
|
|
|
|
Hi there,
I created a process that opens up a word file and its contents are parsed. Now, when the user tries to open up the exact same file, it doesn't parse. Is it because the file is currently open? How do I check that and would I need to terminate the process before creating a new one? Here is what I have so far.
Thanks!
/*************************************************/
STARTUPINFO stStartUpInfo;
PROCESS_INFORMATION pProcessInfo = new PROCESS_INFORMATION;
memset(&startInfo, 0, sizeof(STARTUPINFO));
startInfo.cb = sizeof(STARTUPINFO);
startInfo.dwFlags = STARTF_USESHOWWINDOW;
startInfo.wShowWindow = SW_SHOWDEFAULT;
CreateProcess(NULL, cmdline, NULL, NULL, FALSE,
NORMAL_PRIORITY_CLASS, NULL,
NULL, &startInfo, procInfo);
ParseFile();
/********************************/
int CParser::ParseFile(CString filename)
{
int ret = 0;
CStdioFile fname;
if (fname.Open(filename, CFile::modeRead))
{
//parsing code here
}
else
{
ret = -1;
fname.Close();
}
return ret;
}
|
|
|
|
|
Hi,
How to send msg to a window where i can't reach..
e.g: Mainframe=>splitter pane=>frame=>splitter pane=>formview
now I want to sen msg from mainfrm to formview..
How can i send this..
THAT'S THE QUESTION.
Thanks
Sumit Kapoor---
|
|
|
|
|
Use the API function GetWindow to walk down the child list of each window below Mainframe. You'll need some way to identify the correct children (assuming that one or more of the levels has > 1 child) but as you assumedly know who you're trying to send a message to that shouldn't be a problem.
Does that help?
Chris
|
|
|
|
|
Hi Dear,
I want to send a Message to sub-sub window class...
I know there is role of Spy++ in this...
please give me any idea..what to find in spy++ & How to send messag to that class..
If possible code snippet for msg send...Please....
Thanks
---Sumit Kapoor---
|
|
|
|
|
Take a look at either the SendMessage() or PostMessage() API calls in MSDN.
Jeremy Falcon
|
|
|
|
|
hi,
my actual class is so deep I cann't use send message from mainframe to that class.
I think need to use spy++..but how to..I don't know..Plesase help me..
Thanks
Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
If you have a handle to the child window, just use SendMessage() . Otherwise, if you are using MFC, does SendMessageToDescendants() help?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|