|
Can anyone help with this one? I am in one process. I use getforegroundwindow ato get the handle to the active Window. However, If it is a view, it does not give me the control that has the focus. This is what I want. I have tried to get GetFocus, etc but nothing seems to work.
Any ideas?
Thanks.
|
|
|
|
|
I have an app that I have a file name as a cmdline data. I use __argv[1] to access this. I will store this to use later. If the file exists, when I try to open it it is fine.
However, I am getting a strange thing when the file does not exist. In my program I don't use it or allow the user to build a file using this name with new parameters. However, my program automatically exits and the OS tells me that the file can not be found. I have looked at my code backwards and forwards. THis has to be the OS or MFC doing this. I have a feeling it is the CCommandLineInfo and ...ProcessShellCommand... In MSDN, it seems to say that the file will be taken as a file to be opened by the App. Is there a way around this? I do not use the OPen etc functions at all.
This has been bugging me for half a day now. Thanks for any help.
|
|
|
|
|
ummmm how about not doing the command line processing but just pulling the filename for use later in your app?
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
Do you happen to use an MFC class, like CStdioFile, to open the file? I believe CStdioFile (and others) can throw an exception if the file doesn't exist. That could cause your program to exit if you don't catch the exception.
Just a thought...
No generalization is 100% true.
Not even this one.
|
|
|
|
|
Put break points and try and locate the error area.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I have been trying to change icon of executable by using APIs like UpdateResource. But this doesnt work for me. I always corrupt the resource . Infact the old ones remain there and new gets in but in corrupt form. I am using WinXP Pro. Can somebody guide me about how to do it.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Why are you using an API to change the resource? Use the Resource editor. The icon with the lowest resource ID is your program's icon - what shows in Windows Explorer, for instance. Make sure to have a 16x16 image, and a 32x32 image. Include a 48x48 image if want your icon to show up nice and pretty on XP systems showing files as "tiles".
No generalization is 100% true.
Not even this one.
|
|
|
|
|
No I need to change icon at runtime. I have one exe which has to chaneg some information in another exe which includes changing main icon. So it has to be done by API. I tried other libraries but nothing works. Can u help me.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Of course, my initial reaction to this problem would be to re-think your design. But I can't think of a way to do it at runtime...
No generalization is 100% true.
Not even this one.
|
|
|
|
|
Well thanks for your time. I have found a solution.
The icons are placed in Exe with numbers 1,2.....So first number represents 32x32 pixel icon and 2 represents 16x16 pixel icon. The problem in my approach was that I was tryin to change Icon Group and Icons. But when I changed only Icons and not icon group it worked because icon group is just a refrence to it. If you want I can mail you the code I used.The second problem was in reading ICON file. I was not reading correct information which was causing corrupt icons in exe.It works fine using UpdateResource API.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
hi
you can change/add the icon of ur application easily
You can import new icons from anywhere and then add them as your resourse(that will automatically added when u import)and delete/change name of IDR_MAINFRAME and rename the new icon resourse as IDR_MAINFRAME ...an easy and tricky way...hahahaha
ok try it now....!
Renjith
sofware behind everything...
so enjoy with the codes...
Renjith Pandalam
|
|
|
|
|
No I wanted to change Icon of an exe at runtime and not through IDE. But now I have found a solution. Read my comment below.
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=169709#xx169709xx
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
You're going to have to use the UpdateResource() API.
Jeremy L. Falcon
"Tickle me Elmo -- please!"
<nobr>
Homepage : Sonork = 100.16311 Maybe my mangling might misguide malicious miscreants momentarily?
|
|
|
|
|
I have 2 edit boxes, A & B. B cannot have a value in it unless A does. B is disabled until A gets a value. When the user erases the value in A, I want to disable and erase the value in B. This all works fine in the debugger with the following code:
if (m_VidValue.IsEmpty())
{
m_Prefix = "";
GetDlgItem(IDC_VID_PREFIX_EDIT)->EnableWindow(FALSE);
UpdateData(FALSE);
}
When I run the code outside the debugger, the field gets disabled, but it does not clear. I can make it clear by forcing a RedrawWindow(). Is there a better way to do this without redrawing and getting the annoying flicker?
Thanks in advance,
Bob
|
|
|
|
|
You could try using SetWindowText("") to clear an edit box, for instance:
m_Prefix = "";
CWnd *pControl = GetDlgItem(IDC_VID_PREFIX_EDIT);
if(pControl)
{
pControl->SetWindowText("");
pControl->EnableWindow(FALSE);
}
No generalization is 100% true.
Not even this one.
|
|
|
|
|
SetWindowText does not work either, unless I do a RedrawWindow().
|
|
|
|
|
Hmm, that seems odd. Are you doing the SetWindowText before you disable the window?
You might be able to get away with a RedrawWindow only on the edit box, and not the whole dialog, which may help the flicker problem.
No generalization is 100% true.
Not even this one.
|
|
|
|
|
Yes, I am doing the SetWindowText before I disable the window. I've also tried doing a RedrawWindow on the edit box, but that doesn't work.
|
|
|
|
|
Did you try:
GetDlgItem(IDC_VID_PREFIX_EDIT)->Invalidate();
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
|
Hello:
I've migrated a VC6 project to VC7. I've no errors when compiling it. The project consists in several DLLs and a executable project. Everytime I build the solution, all resource files in every DLL is recompiled.
How can I avoid this innecesary recompilation of the resource files.
Thanks in advance,
Jose
|
|
|
|
|
You are in good company. Many have been bitten by this bug. Makes you wonder if the MS QA is ever going to be back from the "vacation". :-/
Anyway, head on over to the MS newsgroup microsoft.public.dotnet.languages.vc for a possible solution. The more people that complain, the more MS might realize "Oh sh*t, we've once again screwed up. Maybe we _should_ hire some QA people?" and not continue to treat us as guinea pigs year after year.
|
|
|
|
|
Mike Nordell wrote:
and not continue to treat us as guinea pigs year after year.
Just a thought...Higher level...
We are guinea pigs to Microsoft as our users are guinea pigs to us
Nick Parker
|
|
|
|
|
i want a [12][12] array containing text in each bit
im not sure where i need to declare it and where to put it in the main program.
any help on how to set it up would be good
thanks
beginner
|
|
|
|
|
i would put it in the procedure you're using it in, unless you want it to be global..
|
|
|
|