|
Thanks, hooks are next on my list of things to try out. However, I seem to remember that adding hooks can slow down the system but my knowledge about hooks might as old as from Charles Petzold's "Programming Windows 3.1"
As far as I can see will the WS_EX_LAYERED let mouse message pass through unless there is painted something on the window or the alpha value is greater than 0 (which means only semi-transparent)....
I will look into hooks
|
|
|
|
|
I am developing a BlackJack game and cannot find out how to Hide control buttons when the user should not be able to click them. You can set the property in the Properties box of the control ([] Visible) , but I am confused as to how to then make it Visible again when the user has the option to click the button.
Any Help,
Neal
|
|
|
|
|
Use ShowWindow with the SW_SHOW or SW_HIDE flags.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Thanks Alvaro...works like a charm. To think, I was using EnableWindow anyway. At least I know now, Thanks again.
|
|
|
|
|
I am going to start using CVS. I am a one man shop so something big like sourcesafe is not required. My question is, I am using VC.NET and wonder what file I should commit to CVS. I know I should put my header and cpp files, but should I include the .vcproj and .sln files? Can I recreate those files by creating a new project and just adding my header and cpp files into the project, oh and resource directory?
I just notice vcproj, .sln, and other seem to change each time I open VC.NET and I would have revision 1.1 of a file and all of a sudden my .vcproj or .sln file would be revision 50.1 or something.
Thanks for any insight into the matter.
Code4Food
----
"There is no try; only do or do not"
-Yoda
|
|
|
|
|
Commit everything but .aps, .ncb, .suo, and autogenerated header files from idl-files. It's better to create a new module for midl-generated header files IMHO.
.vcproj and .sln you want to keep. it stores information about your project in general (files, compiler settings). Only commit then when you know you've made changes (like added a new file, changed some configuration, etc).
This seems to be working for me so far.
--
Only in a world this sh*tty could you even try to say these were innocent people and keep a straight face.
|
|
|
|
|
Thanks for the response!
Code4Food
----
"There is no try; only do or do not"
-Yoda
|
|
|
|
|
I want to know as to how to close my view i.e Kill the view in my MDI Framework when I encounter an error condition .
As for example one of the Initialization routines in the View fails in which case I need to terminate or kill the View. What is the correct way of doing this ? Please help
|
|
|
|
|
DestroyWindow should do it. If not, post some code that may help us assist you.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Hello,
I'm having the following problem; when I try to put a CRectTracker inside a CScrollView, it LOOKS fine, but doesn't actually work. As soon as I scroll an item inside the CRectTracker out of the screen, it appears as if the item IS outside the working area, but the actual rectangle surrounding the item remains stuck to the side on which I scrolled it out. So the picture appears to be half out of the working area, but when I click next to the picture, it still grabs the rectangle and I see the surrounding rectangle line as if the objects border is at the working area border.
Does anyone have a solution for this problem?
Thanks,
- Fahr
|
|
|
|
|
If I understand correctly, you need to use CWnd::SetCapture to capture the mouse event to the view that has the action.
you do a SetCapture on the ButtonDown , and you do a release capture on the ButtonUp.
Max.
|
|
|
|
|
I guess that's not quite what I mean...
Check out the following screenshots, the first one shows where the rectangle is when I select it. The second one is more clear, it shows the border of the rectangle is sizing dots, while the content is obviously scrolled out...
screenshots:
http://www.lycantrope.com:5000/~Vahlinear/recttracker1.jpg
http://www.lycantrope.com:5000/~Vahlinear/recttracker2.jpg
Thanks,
- Fahr
|
|
|
|
|
I think Fahr's problem is similar to my problem.I want to explain more , maybe someone could solve our problem.
I wrote a program that someone could choose items from a toolbar and put them on the document by clicking left
button of mouse on the view. I considered a CRectTracker variable for each symbol and in the OnDraw function I
draw each symbol's tracker's rectangle.And for selecting each symbol which is shown on the page I check if the
position of left click of mouse is in the tracker of any of the symbols or not.At the beginning I used CView class
but now I want to use CScrollView in order that my program could support scrolling.I changed the base class of
my view class to CScrollView and write some lines in its OnInitialUpdate in order to set the size of scrolling.Now I
scroll my program but when I put an item on the page and scroll the page , in some places that my item doesn't
exist , it seems that its tracker exists and if I move it or delete it or sth else , those changes would be applied on
the real item that is somewhere upper than there. I think I should change the coordinates of the CRectTracker
variable of my item , but I don't know how.
Thanks
Azadeh
|
|
|
|
|
From a Win32 C++ program, running on Windows 95/98/Me, how can I:
1. Launch a process
2. Wait for the process to finish
3. Resume program execution after the process finishes
The obvious answer is to use CreateProcess and WaitForSingleObject... but, for whatever reason, this is NOT working. It is very strange - what I am trying to do is launch a little executable that sees if any Add New Hardware dialogs are running, and if so, wait for them to finish. If I launch this app manually (e..g, from Windows Explorer), it works fine. If I spawn it from a third executable using CreateProcess, it also works fine. But if I try to do a WaitForSingleObject on its process handle, it apparently causes some sort of deadlock with the Add New Hardware wizard, and they both lock up.
So is there some way around this? I am guessing a method of waiting for an executable to finish that does not rely on WaitForSingleObject would be sufficient. This is for Windows 9X, which sucks anyway, so I don't care if the solution is inefficient. Just as long as it doesn't lock up.
Even a broken clock is right twice a day.
|
|
|
|
|
This is weird. As you said you don't care about dirty solutions, maybe this can do it:
for(;;){
if(WaitForSingleObject(hProcess,0)==WAIT_OBJECT_0)break;
Sleep(100);
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
After reading what Mike Dunn said, and looking into this FindWindow thing, I think this may work. Guess I'll just have to cross my fingers and try...
Even a broken clock is right twice a day.
|
|
|
|
|
Nice idea, but I found it doesn't work...
Even a broken clock is right twice a day.
|
|
|
|
|
Are you using FindWindow(Ex) to look for the Add Hardware dialogs? If so, then FindWindow(Ex) has a known bug on 9x that can cause a hang. (I can't find it in the KB now, but I know I've seen it.) We ran into this at work at we just had to skip the FindWindow checks on 9x.
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Yeah. Actually, another team wrote the code that searches for the window, and I believe it does use FindWindow. There is a nifty API you can call to see if a plug and play is happening, but it only works for 2K and XP. So I think we're stuck using FindWindow.
Ack! I hate 9X.
Even a broken clock is right twice a day.
|
|
|
|
|
Why not use ::EnumWindows() instead of FindWindowEx() ?
Navin wrote:
Ack! I hate 9X
me too!
I prefer to wear gloves when using it, but that's merely a matter of personal hygiene
[Roger Wright on VB]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
[Rich Cook]
|
|
|
|
|
Actually, I think the problem is in EnumWindows, becuase FindWindow apparently calls EnumWindows internally or something.
Even a broken clock is right twice a day.
|
|
|
|
|
I'm just going by this:
http://www.codeproject.com/cpp/avoidmultinstance.asp[^]
AFAIK, this guy knows his stuff, so I've been using EnumWindows instead f FindWindow[Ex].
GL!
I prefer to wear gloves when using it, but that's merely a matter of personal hygiene
[Roger Wright on VB]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
[Rich Cook]
|
|
|
|
|
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
si.cb = sizeof(si);
int rv = CreateProcess(exe, copyOfArgs, 0, 0, 0, 0, 0, 0, &si, &pi);
if (rv && wait)
{
unsigned long status = 0;
do
{
sleep(sleepDelay);
rv = GetExitCodeProcess(pi.hProcess, &status);
}
while ((status == STILL_ACTIVE) && rv);
}
if (pi.hProcess) CloseHandle(pi.hProcess);
if (pi.hThread) CloseHandle(pi.hThread);
NOTE: I have a custom sleep function that calls PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE); I ran into issues in multi-threaded apps.
Todd Smith
|
|
|
|
|
I need a help in DLL area. My co-worker is passing me a Carray data type into my dll and that seem to cause a "access violation error" in his exe when he tries to delete that Carray value. When I look into his program, it seem to failing at FreeLibrary call. It was detecting an memory error there. So, I made up a sample program to talk to the dll and it was fine. He is using sometype of Active X component and I am not sure if that may have something to do with it but I was going to see if any of you guys had a problem with passing MFC datatype into Dll. I tried it through MFC extention dll and regular Dll and both failed in same way. Any information would help me. Thanks!
My DLL side:
extern "C" __declspec(dllexport)
int InitProcess(LPSTR lpPortName, HWND hWnd, CArray<cmdarray,cmdarray &=""> *pMsg)
{
pMsg->ADD(type);
return 1;
}
Co-worker's Main side:
CArray <cmdarray,cmdarray> *m_pCmdArray;
m_pCmdArray = new CArray <cmdarray,cmdarray &="">();
typedef int (* LPFNINITPROCESS)(LPCSTR,HWND, CArray <cmdarray,cmdarray &=""> *);
LPFNINITEPROCESS lpfnInit;
lpfnInit lpfnInitProcess;
hLib = LoadLibrary("MYDLL.dll");
lpfnInitProcess((LPCSTR)COMPORT, this->m_hWnd, m_pCmdArray);
FreeLibrary(hLib); <------------------ memory leak detect;
delete m_pCmdArray; <------------------ access viloation error... yack..
|
|
|
|
|
keb wrote:
extern "C" __declspec(dllexport)
int InitProcess(LPSTR lpPortName, HWND hWnd, CArray *pMsg)
{
pMsg->ADD(type);
return 1;
}
Co-worker's Main side:
CArray *m_pCmdArray;
m_pCmdArray = new CArray ();
typedef int (* LPFNINITPROCESS)(LPCSTR,HWND, CArray *);
LPFNINITEPROCESS lpfnInit;
lpfnInit lpfnInitProcess;
hLib = LoadLibrary("MYDLL.dll");
lpfnInitProcess((LPCSTR)COMPORT, this->m_hWnd, m_pCmdArray);
FreeLibrary(hLib); <------------------ memory leak detect;
delete m_pCmdArray; <------------------ access viloation error... yack..
This is not a paste and cut example code snippet, I can't see any call to GetProcAddress()
Give us the whole code... perhaps it has to do with MFC and regular DLLs... hm..
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|