|
Thank you.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
How can i change application icon dinamicaly?
|
|
|
|
|
If using MFC: CWnd::SetIcon
/moliate
|
|
|
|
|
Icon must be stay changed after close application (In Explorer - another icon).
|
|
|
|
|
You cant change your exe file's icon dynamically. You'd have to recompile it with a new icon. Unless you figure out some way to open the file and overwrite the icon with a new one.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
To do so, you would need to update you main icon resource. If this is what you're after, you might want to check out:
BeginUpdateResource()
UpdateResource()
EndUpdateResource()
on MSDN. You'll need to use them to change your icon dynamically.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
That is a lot harder. May be impossible. A possible solution might be to spawn a new process when the application is about to terminte. The process kills its parent, opens the parents .exe file, finds the icon and replaces it before terminating.
I really don't know if it will work. If the iconswapping is critical for your application you might give it a shot. As Derek pointed out you can use the resource function set.
/moliate
|
|
|
|
|
Icon must be stay changed after close application (In Explorer - another icon).
|
|
|
|
|
Hi,
I wanna ceate an SDI app with a CEditView or CHtmlView in it, and change between them per buttonclick.
The only thing I don't know is how to begin and then how to continue.
Would you help me, please?
Thank you.
Recaro
|
|
|
|
|
You should be able to do this by getting a pointer to the view you want to activate. Then gets its container child window and call MDIActivate() on it.
CView *pView = ... ;
CChildWnd *pChild = (CChildWnd*)pView->GetParent() ;
pChild->MDIActivate() ;
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge
|
|
|
|
|
Hi.
I am studying MFC from Jeff Promise's book. I had problems compiling the first sample MFC program from Prosis because I need to set the project from "single-threaded" to "multi-threaded."
First, "multi-threaded" works, but the execute is huge, maybe five-folds from my biggest win32 console program with many more lines of code. The size of "multi-threaded" un debug mode was 1.5mb. There are less than 100 lines of code. I tried to set "multi-threaded" to "multi-threaded DLL," but then Visual C++ would not compile the source . It responded with a bunch of errors. Do I need to install anything before using the multi-threaded DLL mode?
How does MFC works as far as software release? Let say I give the MFC program to a friend. Will the friend be able to run it? Is MFC/C++ similar to Java and VB where the program comes require specific system DLL?
Lastly, Promise's book is exceptional because it touches everything about MFC. I found some MFC syntax that are not like C++ (or maybe it is just my inexperience). For example, some derived functions return "BOOL" and "TRUE." I know C++'s "bool" and "true." I replaced "TRUE" with "true," and that worked okay. However, Visual C++ came up with errors when I replaced "BOOL" with "bool." Are syntax like th ones above MFC specific and are required?
Kuphryn
|
|
|
|
|
The debug mode exe will be huge with static linking of MFC. But the release mode exe should be considerably smaller even with static linking.
If you link MFC dynamically, both the debug and release exes will be small with the release exe being really really small.
But if want tiny files use direct API or ATL
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Yes, if you give your program to a friend they must have the correct DLLs resident on their machine. This is generally not a problem but older machines may have a MFC42.dll that is out of date. ComCtl32.dll is another one to watch out for but machines with recent OSs and service packs should be fine.
Regarding BOOL and bool, BOOL is a type defined as an int in windef.h. bool (lower case) is a built-in variable type having a size of 1 byte and this is from the standard. It is best to leave BOOL as BOOL because they are different types as of MSVC v5.0.
|
|
|
|
|
Okay. Thanks.
First, I would really want to multi-thread using DLL (dynamically). I will post the errors as soon as I get access to the source at home.
One more question about MFC syntax. I learn from Deitel & Deitel to using "0" instead of "NULL." However, MFC uses "NULL" consistantly. Should I use "NULL" as Promise implements it?
Kuphryn
|
|
|
|
|
Okay. I tested two versions of multi-threaded DLL.
multi-threaded DLL (DEBUG): Here are the errors when I tried to compile.
----------
-----
Hello error LNK2001: unresolved external symbol ___argc
-----
Hello error LNK2001: unresolved external symbol ___argv
-----
Hello error LNK2001: unresolved external symbol __mbctype
-----
Hello error LNK2019: unresolved external symbol __mbctype referenced in function "public: void __thiscall CEditView::ReadFromArchive(class CArchive &,unsigned int)" (?ReadFromArchive@CEditView@@QAEXAAVCArchive@@I@Z)
-----
Hello error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall AfxFormatStrings(class ATL::CStringT<char,class strtraitmfc<char,class="" atl::chtraitscrt<char=""> > > &,unsigned int,char const * const *,int)" (?AfxFormatStrings@@YGXAAV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@IPBQBDH@Z)
-----
Hello fatal error LNK1120: 3 unresolved externals
-----
----------
multi-threaded DLL: Here are the errors when I tried to compile.
----------
-----
Hello error LNK2001: unresolved external symbol ___argc
-----
Hello error LNK2001: unresolved external symbol ___argv
-----
Hello error LNK2001: unresolved external symbol __mbctype
-----
Hello error LNK2019: unresolved external symbol __mbctype referenced in function "public: void __thiscall CEditView::ReadFromArchive(class CArchive &,unsigned int)" (?ReadFromArchive@CEditView@@QAEXAAVCArchive@@I@Z)
-----
Hello error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall AfxFormatStrings(class ATL::CStringT<char,class strtraitmfc<char,class="" atl::chtraitscrt<char=""> > > &,unsigned int,char const * const *,int)" (?AfxFormatStrings@@YGXAAV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@IPBQBDH@Z)
-----
Hello fatal error LNK1120: 3 unresolved externals
-----
Hello warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
-----
----------
I would like to compile MFC using multi-threaded DLL, thus making the program smaller.
Thanks,
Kuphryn
|
|
|
|
|
Okay. I figured out the problem. The problem was there were mismatch settings in the project. The probject was default to Applicantion(exe) and Standard Windows Libraries. I had to set the project to use "Shared MFC DLL" instead of Standard Windows Libraries.
The executed size shrinks from 1.5mb to 100k in debug mode.
Kuphryn
|
|
|
|
|
I've recently upgraded to VC7,When I wanted to add some activex to my project,I couldn't find Adoc and MSDataGrid,Does anybody know is there any new activex instead of them or what happend to them or any idea?
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
double& GetDouble(void* p)
{
double* pd = (double*)p;
}
modified 29-Aug-18 21:01pm.
|
|
|
|
|
return *pd;
I vote pro drink
|
|
|
|
|
Thank you. It has been a long day and I am not thinking right. This is an indicator that I have to go home and get some sleep.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Another question guys. This time it should be REALLY simple but I'm too tired/lazy to look it up. Here goes:
I made a map editor that in the end scans the map you made and saves it in a two-dimentional array. Then it opens a file and writes the array to it.
The problem is that it's saved in one row and I'd like it to show as a matrix when you view the file.
So how do I instruct the FilePointer to drop a line?
By the way I used the WriteFile finction and all that API stuff, not MFC.
Isaac Sasson,
Small time programmer - complainer at large.
Sonork ID 100.13704
|
|
|
|
|
With a \r\n
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
ROFL
Now don't I feel stupid...
My brain is starting to degenerate, must be all those Neighbours episodes I've been watching
Isaac Sasson,
Small time programmer - complainer at large.
Sonork ID 100.13704
|
|
|
|
|
Isaac Sasson wrote:
Neighbours episodes I've been watching
What show is this...?
In Canada we get mostly American TV like most of the world and i'e never heard of this...?
Sounds like a knock off of friends...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
It's an Aussie drama, though christian claims it to be a soap oepra. I think it's not because the issues that are quite normal and not "my evil twin stole my mutant baby" and stuff like that.
It's about the lives of the people in the same street.
Isaac Sasson,
Small time programmer - complainer at large.
Sonork ID 100.13704
|
|
|
|