|
There are a couple ways. First of all, if you can, try to link statically. If any of the DLLs are MFC42.dll (or whatever), or MSVCRT.DLL, you can easily link them statically. In fact this would be your only course of action aside from installing them or assuming they are already on the system (both options are dangerous.)
If you link your DLLs implicitly (e.g., using a .lib file), you are screwed. You'll have no choice but to copy the DLL at install time. The only way around tihs is if the provider of the DLL also gave you source code or a library you can statically link. Then you can do that and not need the DLL at all.
If you have a DLL that you call explicitly (e.g., via LoadLibrary ), it is convoluted, but possible, to do what you want. I cannot remember the exact code, but the idea is this:
1. Before compiling, in your resouce file, insert the DLL as a resource (make it a custom type, or "FILE" or something.)
2. In your code, Using resource functions, extract that resouce and save it into a temp directory (e.g., call ::GetTempDirectory and save it there.)
3. In your LoadLibrary call, use the path that you extracted it to (temp dir + DLL name.)
Sorry I can't provide the exact code, but it is on my work computer, and I am not about to go into work on a holiday.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Hi,
I'm using VStudio .NET 2003 Enterprise Architect, and I've build a program to convert some files (I did this in managed C++). But I've got a problem:
I need to install my program on network HD (probably on a server), and my collegaes don't want to have to install the software on each of their computers. They just want to be able to run it, or my program. I can install it on the network, so they can just use the .exe.
I don't use register or config files, all the files needed for IO (some input and some output files) are already available on their pc's, and those fiels will be selected using a dialog.
Can you help me making sure nobody needs to install the software (except for me)?
Thank you in advance,
Boudewijn Ector
|
|
|
|
|
while (WaitForSingleObject(m_hFunThread,0)==WAIT_OBJECT_0)
{
Some operarions;
}
Can someone tell me the actions of the above sentences?
Thank you!
|
|
|
|
|
It will execute 'Some operations' if m_hFunThread is signaled. If m_hFunThread is not signaled, then WaitForSingleObject will return WAIT_TIMEOUT and the program will continue after the while block.
This seems like an ..unusual thing to do.
Ryan
|
|
|
|
|
From your last question, I think you want to do
while(WaitForSingleObject(m_hFunThread, 0) != WAIT_OBJECT_0)
{
} What operations do you need to do while you're waiting? If you're just waiting and don't actually need to do anything while you wait, then use
WaitForSingleObject(m_hFunThread, INFINITE); to wait until the object is signalled.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
My project is a sub-project. The main project controls my project.
It will call a function(OnClose())When requiring to stop my project.
Herein there exists a problem.
If the main project breaks down my project.
Something wrong will happen considering to one of my functions being running.
So I want to pop up a dialog to warn the user.
If the user still want to stop the project no matter whatever will happen, I will stop my running function,
else I will keep my function going on and let the following block not to be executed until that function has been run out.
|
|
|
|
|
OK. In that case, my first suggestion should work
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
But my entire programme was stopped.
Maybe the first parameter is wrong.
Can you tell me what kind of parameter can be used as the first?
My main dialog in my project call the riskful operation, which is a memeber function of my self-defined class.
"m_hFunThread" is one memeber of my main dialog's base class, and it should be a single thread, so my entire programme stopped.
But,every main function in my project is called by using multiple-thread way
What should I do?
|
|
|
|
|
Aleon666 wrote:
But my entire programme was stopped.
What did the WaitForSingleObject() function return? Did it return WAIT_TIMEOUT? You might want to change it from != WAIT_OBJECT_0 to == WAIT_TIMEOUT .
Aleon666 wrote:
what kind of parameter can be used as the first one?
Look at the docs for WaitForSingleObject() . There are quite a few types that can be used. I assume hFunThread is the handle to your thread. The function will return WAIT_SIGNAL_0 when the thread completes, and WAIT_TIMEOUT otherwise, unless there is an error, where WAIT_FAILED will be called.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
The main project has a release executable programme, I want to step-debug the errors, but I don't know how to DEBUG from the main project to my sub-project.
And so I don't know the returned value.
Do you know the ways?
After I displaced "!= WAIT_OBJECT_0" with "== WAIT_TIMEOUT" the programme had the same result.
As to "docs", your maening is to read some contents in MSDN, isn't it?
|
|
|
|
|
Aleon666 wrote:
Do you know the ways?
Set a breakpoint at that line and just run the entire program in the debugger. It will stop when it gets to that line.
Aleon666 wrote:
After I displaced "!= WAIT_OBJECT_0" with "== WAIT_TIMEOUT" the programme had the same result.
It stopped working at all? Hmmm. Sorry, but I think I've used up all my knowledge on multithreading I haven't done much.
Aleon666 wrote:
As to "docs", your maening is to read some contents in MSDN, isn't it?
Yeah, the information on WaitForSingleObject() . It list the handle types that support waiting for.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
The main project has nothing but an exe file and my sub-project.
I must run from the exe file.
When I run the entire program in the debugger, there is a dialog popped up, saying that "..\main.exe" does not contain debugging infomation.
Thank you very much!
|
|
|
|
|
I think out a way.
I add to a varible to control the "close" function
When the requirement is verified to stop my funtion, I stop the function directly,
else I close the dlg after my function is finished by calling "OnClose" according to the varible "m_bStopRequire".
|
|
|
|
|
I'm glad you've sorted it out
Sorry I couldn't be of more help
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
In my database date is in text format (like 20030704)
and i've to display that date in CDatetimeCtrl, after getting year month and date i am assigning that to control as follows
CTime tm(yr,mn,dd,0,0,0);
CDateTimeCtrl.SetTime( &tm );
It is showing correct in case year is above 1970, and
showing currentdate if year is 1970-
'What could be the reason and any suggesstions how to solve it??
With Thanks and Regards
--Kamesh
|
|
|
|
|
CTime doesn't support dates before Jan 1st, 1970. This is due to the C runtime library not supporting these dates in the time_t type. Use COleDateTime instead of CTime to get a greater time range.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
If we keep on posting the same answers at the same time, I'll quit.
~RaGE();
|
|
|
|
|
Rage wrote:
If we keep on posting the same answers at the same time, I'll quit.
Don't do that!
I find that that happens a lot - I'm always posting at the same time as other people. I think it's just me
OT: I think I've got the record for the fastest reply . I posted a reply to a message last night so quickly that it showed up when the guy who posted the original message got back to the forum page after sending his message How's that for posting speed?
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I did not check back, but if I remember well, 1970 is the lowest date you can have in a CTime. So maybe you should use a COleDateTime, which is also DateTimeCtrl compliant and which can contain any date/time.
~RaGE();
|
|
|
|
|
I'm trying to develop a cad system using MFC and OpenGL. Since I'm not an expert, can anybody explained what is the best way to do plotting.. as we know cad drawing can be very big.. most example translate the opengl drawing into DIB but this wouldn't be practical when we have big drawing as it will require huge amount of memory. Anybody got any idea ro solution maybe. or do i should thick to translating the drawing to DIB?
Thanks
p/s: sorry for my english.
|
|
|
|
|
Hi,
I have a SDI application with a listcontrol. Some fields must be in BOLD.
I have tried something with LOGFONT, but when i try to get the current logfont?, Windows gives a error at the moment that the application starts.
gxListCtrl::gxListCtrl (CString Text) <br />
{<br />
...<br />
LOGFONT lfFont;<br />
GetFont()->GetLogFont(&lfFont);<br />
Regards,
Willem
|
|
|
|
|
whofmans wrote:
Windows gives a error at the moment that the application starts
Maybe that's because you make your call to GetFont() too early, and that no font had been loaded yet. Where does the app hang when debugging ?
~RaGE();
|
|
|
|
|
GetFont() doesn't return a valid value until the control is created. The earliest you can call the GetFont() function is from the control's OnCreate() handler.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks for your help! Bold looks good.
|
|
|
|
|
I have opened a file and have a handel . Now how can i get file name back from that handel?
API GetFileInformationByHandle() returns lot of things but not file name...is there any other API that can help me out ??
thanks
|
|
|
|