|
thanks!
|
|
|
|
|
Is it possible? I am designing a thread pool and I have a vector of thread handles. If I need to terminate a thread I need to inform the derived class that the thread was terminated for this I need to send the thread ID. I know I could just store the thread id as a class member variable also but can I get a thread id of an executing thread knowing its handle??
John
|
|
|
|
|
Use GetThreadId( ) API
DWORD GetThreadId(
HANDLE Thread
);
It should work in Win2k.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
I have just been told on another site that that only works for Windows 2003 and and above...
John
|
|
|
|
|
Its actually implemented in kernel32.lib. So it should work.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Thanks for the info..
John
|
|
|
|
|
I'm using VisualC++ 6.0. How can create a project so I can use and return CString?
Cheers,
Jo
|
|
|
|
|
Umm I'm assuming that this isn't the question you actually meant, but all you have to do is create a MFC Dll in the wizard and you have access to it.
Mike
|
|
|
|
|
Mike Danberg wrote:
I'm assuming that this isn't the question you actually meant
Actually, that is the question I was asking. I'm very new to DLL, so when I started, I just created Win32DLL (there is no option to enable MFC on this Win32DLL project type in VC++6.0 AppWizard), then later I found out I need to use CString. So in that Win32DLL, I added #include <afx.h> after #include <windows.h> (this .h is included by the AppWizard). As it turns out in Afx.h there is macro that said you can't include #windows.h if you want to use Afx.h
So that is the reason I have that Q. Now I know I have to choose MFC(DLL) project type. Thanx.
cheers,
Jo
|
|
|
|
|
I'm using Visual C++ 6.0.
Can you use a third party DLL that doesn't come with .LIB and .H? Can we regenerate .LIB and .H from the DLL?
cheers,
Jo
|
|
|
|
|
Johan_yo wrote:
Can you use a third party DLL that doesn't come with .LIB and .H?
Use LoadLibrary() and GetProcAddress() .
Johan_yo wrote:
Can we regenerate .LIB and .H from the DLL?
You cannot generate .H files. You can, however, generate the .LIB files, but I have not done this in nearly 10 years, thus the utility to do so (IMPLIB, maybe) escapes me.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
the utility is called "lib"
Don't try it, just do it!
|
|
|
|
|
Alexander M. wrote:
the utility is called "lib"
After I generate the .LIB file, how can I use the class exported from the DLL?
Don't I need a .H file so I can say #include <thedoth.h> in my CPP?
I know what the classes and their exported method are. I'm still quite new using DLL, so my Q might sound stupid.
cheers,
Jo
|
|
|
|
|
Alexander M. wrote:
the utility is called "lib"
Sorry, earlier I thought I got Lib.EXE to create the LIB file, but it actually failed (stupid me didn't look at the error message). I typed:
PathToMyVC\lib.exe myDLLPAth\myDLL.dll /DEF:C:\test
I got:
myDLLPath\myDLL.dll : fatal error LNK1136: invalid or corrupt file
What is the proper way to use LIB.exe?
cheers,
Jo
|
|
|
|
|
DavidCrow wrote:
Use LoadLibrary() and GetProcAddress().
Can I use LoadLibrary then access a class in the DLL? The DLL I want to use, exports 3 classes. How can I use the class, GetProcAddress() can be use with functions only, right?
cheers,
Jo
|
|
|
|
|
Johan_yo wrote:
Can I use LoadLibrary then access a class in the DLL?
As I've never tried this, I do not know.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
I'm trying to write a prgram which will continue to run (maybe invisibly on the background) and will track all user keystrokes and will write them in a log file.
Any pointers on how such a prgram can be written?
Please help
|
|
|
|
|
This is what you are looking for...
Start Here[^]
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
|
I am trying to teach myself C+. I wrote a little code in notepad and I downloaded the free borland compiler. How do I get the compiler to make the code work? I'm lost and know nothing, please help!
|
|
|
|
|
Some ideas:
1. RTFM. I mean, the compiler had to come with some sort of documentation, so check that out. Most of us here use Microsoft's compiler so I'm not sure how many of us could help you with Borland's.
2. Run the compiler on the command line and see what kind of "usage" messages you get back. It may list all the compiler options available.
3. Search the web for documentation on the compiler. The Borland site may help.
Good luck,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Hi there
I would suggest you get a compiler with a graphical user
interface(gui), with icons and buttons to click.
Command line compilers can be difficult to use especially
for beginners. I'm new to programing myself and i found it
to be to huge of a mission since i am a beginner.
So i got myself Visual Studio.Net easy to use.
There are free gui compilers like Bloodshed witch you
can download.
http://www.bloodshed.net
regards bhangie
|
|
|
|
|
I have a CString vector with names of directories I got with findFTPFile() after going over to an FTPSite with GetFTPConnection. I need to show these directories like we see in windows explorer, so the user can click on the dir folder and go into it and select the file he wants to ftp back. Is there a simple way to do this?
I started looking into the CP wanderer ftp project but soon got lost.........it might be more complicated than I want anyways. But maybe this is not a simple task to do what I want?
Thanks,
ns
|
|
|
|
|
You'd need a Tree control (CTreeCtrl/CTreeView) on the left and a List control (CListCtrl/CListView) on the right. Sounds like a lot of busy work.
How about having your app invoke an FTP application such as FTP Explorer[^]. It already does what you need and it's free!
It just may be what you need to save yourself a lot of extra effort.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Thanks! Thats a good idea.
ns
|
|
|
|