|
Hello All, I am working in C++ (6.0) for the first time. I am a C#/VB.NET web developer so I feel well over my head.
I got the sample Hello World sample windows app to work, but I need to basically do the same thing only I am writing a DLL instead of an executable. Essentially, I am trying to write a plug-in for another application.
Any sample code, good starting urls would be greatly appreciated. If you evern need help in the ASP.NET world, I will kindly return the favor.
-James
___________________________
J A M E S C O L E M A N
Practice Director, Microsoft
AGENCY.COM
jcoleman@agency.com
http://www.agency.com
|
|
|
|
|
Is it just me, or does this seem like overkill to detect an empty string...
if( strcmp( szPossiblyEmptyString, "" ) == 0 )
No shirt, no shoes, no brains, no service.
|
|
|
|
|
Yes, I usually do
if (!(*szPossiblyEmptyString) )
But this maybe not very readable.
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
if (szPossiblyEmptyString [0] == 0)
That works fine for testing for an empty string. If you also want to test for a NULL pointer
if (pszString == NULL || pszString [0] == 0)
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote: if (pszString == NULL || pszString [0] == 0)
That's a good habit, in case one has to work with BSTR strings.
--
Pictures[^] from my Japan trip.
|
|
|
|
|
Definitely superfluous.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Good Habit to inculcate.
|
|
|
|
|
How do you change the value of CStatic variable dynamically/runtime? Using Visual C++ .NET.
Thanks,
Pat
|
|
|
|
|
|
I'm not sure if I understand. I have the following code:
CStatic m_text;
m_text.SetWindowText(_T("hello there"));
I get a "Debug Assertion Failed" error and the program dies.
Did I do something wrong?
Thanks,
Pat
|
|
|
|
|
PatP07 wrote: CStatic m_text;
That's not enough, that just creates an instance of the MFC class. To create the underlying Win32 window, you need to call Create on it.
|
|
|
|
|
Here's an example copied from MSDN.
CStatic myStatic;
myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER,
CRect(10,10,150,50), pParentWnd);
myStatic should not be a short lived local variable, so it may be a good idea to make it a member of the container class.
|
|
|
|
|
Ok, got it to work...thanks a lot!
P.
|
|
|
|
|
In addition to Nishant's answer:
The C++ objects are just simple wrappers around the Windows API. When you do "raw" windows programming, you deal with window handles. You've probably seen them in code - HWND is their C/C++ type. When you program without MFC or any other toolkit, you either use the builtin functions such as SetWindowText() , or manipulate the windows by sending different messages to them.
What MFC does for the common control windows, such as labels (CStatic ), is that it wraps the window handle, and provides C++ methods for manipulating the windows. The methods then call the corresponding Windows API function or sends the appropriate message with parameters.
What this wrapping business means is that you actually have two objects to maintain in your code! In the case of m_text , there's the actual C++ object, and the actual window. These two object's lifetimes are not synchronized. When the m_text object's constructor has executed, the window object is not yet created. It is created in a successful call to Create() . When DestroyWindow() is called later on, the window object is destroyed, but the C++ object remains. Whenever the window object is not alive, most methods on any CWnd derived class are not available.
--
Pictures[^] from my Japan trip.
|
|
|
|
|
Hi
I want to know how i can extract an exe into memory and then execute it directly from memory. Any idea or ref . Pl. help me.
thanks
|
|
|
|
|
|
He wrote: into memory
he wants to do it "on the fly" not wanting to land on disk !!
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|
|
VivekuniQ wrote: he wants to do it "on the fly" not wanting to land on disk !!
there no way AFAIK... but maybe he can write a temporary exe on the disk, ShellExecute() it, and when it exits, delete the file...?!
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
I want to execute exe directly from memory. I am writing a binder that will bind my project files and execute them to the memoty.I am doing this to make single exe out of several. Any idea or ref.
|
|
|
|
|
is it ok for you, instead of creating an exe "in memory" an launch it as is, to create threads and processes instead ?
as i am understanding your last comment, you're trying to make several independant units that are running separatedly (but maybe synchronized). this way, threads may be what you're looking for...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Well that sounds great.
should i load exe that is at the end of main exe file and create a process with the address of second exe.
well i have joined (appended) 2 exe files. now i want to load 2nd exe (which is at end of 1st exe) to the memory.
|
|
|
|
|
You can embed binary files as "binary" resources inside your exe, easy as embeding an icon.
Then you can save the binary contents as a "temporary" .exe, and execute it.
I hope it helps
Guimasun
GuimaSun
www.nexsun.com.br
NEXSUN TechZone
|
|
|
|
|
Hi
Thanks a lot for help.
I think there is no way to execute exe file from memory.
So i am going to use ShellExecute().
well if i find out any way i'll ley you know.
thanks
|
|
|
|
|
I've a Project with many sub-projects attached to it, in that there are many MDI classes with several Dialogs. I need to change the property(appearance,font,color) of text in those dialogs, making it look equally applied throughout.
I dont think so, i can manually code every dialog to appear same, so i'm looking to write a class that would change the appearance of the text throughout the projects(all dialogs). I'm wondering how to go about this, any one could give me an idea in detail plssss.
Mohan
|
|
|
|
|
I'm using ini file for translation purpose, and to translate dialog I have a call DlgTranslate(this) from OnInitDialog in every dialog. This function traverses all dialog controls, changing text accordingly.
This was long preface The key is that recently I need to adjust font of static controls, and doing this in DlgTranslate was a good choice (while not very structured). You can do similar thing in your case too.
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|