|
if I Have DLL File And I want to use it in my project ...
How I Can Know How many function in this DLL File ,
what are They ? and What are the parameter for each Function in it and data type of them ?
Many Many Thanx for response
Hamoud Alhuttami
Yemen - Sana'a
|
|
|
|
|
open the dll as buffer, the info u need can be viewed from that buffer.
i don't know format of a dll file, but i did it before: as u want to know now.
note: the buffer is in a byte file (including zero in middle), but function's info is in asc ii format.
possile need no more than 1 day to go.
includeh10
|
|
|
|
|
|
1st thank u very much
I wrote the following code to read dll :
(vb code )
dim b as byte
dim c as string*1
open "xx.dll" for random as #1 len=len(b)
open "xx.txt" for random as #2 len=len(c)
while not eof(1)
get #1,,b
c=chr(b)
put #2,,c
wend
close 1
close 2
then I opened xx.txt file to discovering this dll
i read name of functions but the file is not in text format there are symbols blanks ... try this code
it's no help me
suggest ...
hamoud
huttami@hotmail.com
|
|
|
|
|
1st thank u very much
I wrote the following code to read dll :
(vb code )
dim b as byte
dim c as string*1
open "xx.dll" for random as #1 len=len(b)
open "xx.txt" for random as #2 len=len(c)
while not eof(1)
get #1,,b
c=chr(b)
put #2,,c
wend
close 1
close 2
then I opened xx.txt file to discovering this dll
i read name of functions but the file is not in text format there are symbols blanks ... try this code
it's no help me
suggest ...
hamoud
huttami@hotmail.com
|
|
|
|
|
I have the following class
class DynamicArray {
private:
int* m_pInts;
public:
DynamicArray(int elements) {
m_pInts = new int[elements];
}
~DynamicArray() {
delete [] m_pInts;
}
};
This class creates an dynamically sized array of ints.
I also have the following function
DynamicArray GetDynamicArray() {
DynamicArray temp(89);
return temp;
}
unfourtunatly the destructor is called (on temp) when the function returns, which deletes my array of ints.
example:
int main() {
DynamicArray myArray = GetDynamicArray();
}
How do I make this work?
|
|
|
|
|
Joshua Nussbaum wrote:
How do I make this work?
a) implement a copy ctor (the dtor will be still called for your local instance after it has been copied)
-or-
b) don't use local instance of your class, use a reference
void CreateMyDynamicArray(DynamicArray& ref) { ref.Create(89); }
Last line assumes you have an empty default ctor and a Create(int size) method.
PS: I suggest using a container (e.g. std::vector ) instead of pointer/new/delete
|
|
|
|
|
I agree with moak. Use std::vector and be done with it. To see the std::vector and dynamic data array in action, take a look @ my article and demo project, CDataFile[^].
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Can u plz help me out in capturing a TCP packet(Using Winsock2). Plz provide me with the relevent sites/api names/specific functions to do the job.
Reply me soon
|
|
|
|
|
For capturing the packet through Winsock2 look for the "raw sockets" (search for SOCK_RAW in MSDN). This feature is available in w2k and winXP only I guess.
The better way is to go through building the intermediate driver (NDIS), here you can intercept all packets (but the complexity is quite higher). And also you will not receive tcp traffic, but the raw ethernet frames - this gives you more power, but also more work.
Another approach is to use the Filter-Hook driver. This I don't know very well, but possibly it might be the way. For starter here, might be usefull http://www.codeproject.com/useritems/DrvFltIp.asp[^]
Hope this helps...
|
|
|
|
|
If you are willing to settle for libpcap type of reading the wire you might want to consider looking at the winpcap libraries. You could in theory port routines from strong IDS systems (like Snort for example) with very little problem. You can check out winpcap over at http://winpcap.polito.it/[^] and use of the of examples to get the framework in place.
Once the framework is in place you can hook the filters to do your IDS bidding.
Good luck,
SilverStr
|
|
|
|
|
Hello,
This is a continuation of my earlier question. I've reposted because I have more information and my previous post was a bit misleading. I found that my application crashes during the "LoadFrame" statement below located in MyApp.cpp.
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
It seems that my DialogBar's controls are updating themselves before LoadFrame returns and the next statement executes (m_pMainWnd = pMainFrame). When these controls update, I'm trying to get information from the (MDI) Document to fill them, and the program crashes upon the execution of the following CDialogBar code (because m_pMainWnd is null at the time):
CGoalsDoc* pDoc = (CGoalsDoc*)((CMainFrame *)AfxGetApp()->m_pMainWnd)->GetActiveFrame()->GetActiveDocument();
Why are my controls trying to update (e.g., OnKillFocusEditBox1) before the main frame has been created and "m_pMainWnd" has a value? Is there an easy way around this? I don't think I monkeyed with the MFC Wizard too much, but I may have changed something small, yet important.
Thanks!
JennyP
|
|
|
|
|
Does
m_pMainWnd = new CMainFrame();
if ( !static_cast < CMainFrame* > (m_pMainWnd)->LoadFrame(IDR_MAINFRAME) )
{
return FALSE;
} work?
This way you have a non-NULL m_pMainWnd before LoadFrame() executes.
Alternatively, you can wrap your GetActiveDocument call in a
if (initialised)
clause and set a bool initialised to true after you have loaded the MainFrame.
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
After some more time, I found the issue (loosely related):
After deleting a control from my dialog, VC++ assigned the first tab stop to a edit control. I handle the kill-focus message for this edit box and this handler crashes the program because it tries to access the document directly.
Therefore, the fix was to change my tab order so that THIS control was not the first.
Good lesson, but it took too much time to debug for me.
JennyP
|
|
|
|
|
Hi, is there a message when a button is clicked "half"?
I mean when you click a button, but release mouse button while not being over the button. As a result the button has the focus, but of course a ON_BN_CLICKED is not send.
Can I handle this case? I want to give the focus back to the previous control. Do I need to catch mouse messages or is there a button message I can handle?
Thx, Moak
|
|
|
|
|
I have used the WM_LBUTTONDOWN in this case and then compared the mouse position with the button's rectangle (easily obtained from CButtonCtrl) to see if the user clicked in the button you want. There may be an easier way, but that's one method.
JennyP
|
|
|
|
|
or as alternatives... if I don't get a message from the button:
2) How about handling WM_LBUTTONUP once and check GetFocus(). Code must be added to PreTranslateMessage() handler of dialog/view.
3) Send a notify from the button to the parent, if button is released but not full clicked. Requires a class derived from CButton, also dialog/view has to handle WM_NOTIFY .
4) Creating a button that can NOT gain focus... like a toolbar button. I think this approach sounds best (and reuseable), anyone with some comments?
|
|
|
|
|
I want to delay 1 second between two action.
How to implement the function?
My so naive implementation looks like this, would you give clever implementation?
delay(int delay_in_second)
{
for(int i=0; i<=delay_in_second; i++)
{
for(int j=0; j<=10000; j++)
{
;
}
}
}
|
|
|
|
|
You would normally use the Sleep() function but this may not be precise enough if you are writing a real-time controller...
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
You definatly should not use a loop! You might get it perfectly timed on your machine, but as soon as the software is used on a faster CPU then the loop takes less time to perform, and your program messes up big time.
As already identified, you can use Sleep if accuracy to seconds is required. Any more accuracy than that then use the function SleepEx, which takes microseconds, and also allows you to be interrupted. Of course, it all depends on how your program is constructed and what its doing - I dont think a user would appreciate the interface locking up for a second!
|
|
|
|
|
I agree with the above. If you are delaying for 1 second, Sleep() will do, but make sure your sleep is in a seperate thread, or you will be putting the main UI thread to sleep!
That wouldn't go over well, IMO...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hello,
Does anyone know how to call a fortran dll in MS VC?
I need some help calling one.I compiled the file below. Added the .lib file to the link tab. But I get this error.
Linking...
debug/DLL_ROUT.lib : fatal error LNK1106: invalid file or disk full: cannot seek to 0x3e218d3c
Error executing link.exe.
DLL_ROUT_EXE.exe - 1 error(s), 0 warning(s)
Fortram file is below.
<br />
! Fortran part of a C-Fortran DLL example. This<br />
! routine DLL_ROUT is called from a C executable program.<br />
SUBROUTINE DLL_ROUT (INT_ARG, STR_IN, STR_OUT)<br />
IMPLICIT NONE<br />
<br />
! Specify that DLL_ROUT is exported to a DLL<br />
!DEC$ ATTRIBUTES DLLEXPORT :: DLL_ROUT<br />
<br />
INTEGER INT_ARG<br />
CHARACTER*(*) STR_IN, STR_OUT<br />
<br />
! This routine converts INT_ARG to a decimal string.<br />
! appends the string value to STR_IN and stores it<br />
! in STR_OUT. A trailing NUL is added to keep C<br />
! happy.<br />
!<br />
! Note that there are implicit length arguments following<br />
! the addresses of each CHARACTER argument.<br />
<br />
CHARACTER*5 INT_STR<br />
<br />
WRITE (INT_STR,'(I5.5)')INT_ARG<br />
<br />
STR_OUT = STR_IN
<br />
RETURN<br />
END<br />
The main c file is below.
<br />
<br />
#include <stdio.h><br />
#include <string.h><br />
<br />
<br />
<br />
extern "C" void _stdcall DLL_ROUT (<br />
int *INT_ARG,<br />
char *STR_IN,<br />
int STR_IN_LEN,<br />
char *STR_OUT,<br />
int STR_OUT_LEN);<br />
<br />
void main (int argc, char *argv[])<br />
{<br />
char instring[40];<br />
char outstring[40];<br />
int intarg;<br />
<br />
strcpy(instring,"Testing...");<br />
intarg = 123;<br />
<br />
DLL_ROUT(&intarg,instring,strlen(instring),outstring,40);<br />
printf("%s\n",outstring);<br />
}<br />
Thanks Ken
|
|
|
|
|
Are you using MSVC++ 5.0? There's a compatibility problem that prevents 5.0 from using import libraries built for 6.0. The latest SP for MSVC++ 5.0 seems to fix this.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yes Joaquin. I am using MS VC 5.0.
The library was built using Compaq Visual Fortran 6.0
Not sure what is the SP? Are there any work arounds?
Thanks
|
|
|
|
|
Hello,
After deleting a control in a DialogBar, using in VC++ 6.0's Dialog Editor, my program crashes upon the following code execution in the DialogBar's class:
CGoalsDoc* pDoc = (CGoalsDoc*)((CMainFrame *)<br />
AfxGetApp()->m_pMainWnd)->GetActiveFrame()->GetActiveDocument();
The debugger says it's an "unhandled exception". It's as though my DialogBar is looking for a document that's doesn't yet exist yet? How would I go about debugging this issue?
Clues:
When commenting out the creation of my DialogBar in the CMainFrame class, the program gets further in the execution but crashes when trying to access the CMainFrame->m_DialogBar member.
My change that caused this new behavior was the deletion of a CMonthCalendar Control from my DialogBar (and maybe the associated symbol).
Any help would be appreciated! Thanks!
JennyP
|
|
|
|