|
I think the Rick York hint resembles mine: just put the static member initialisation in the DLL cpp (you should have one, at least it is not forbidden...) .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Is it possible to enumerate the entry points a DLL exports (by name)? How?
TIA
ph
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
Do you want to just do it yourself, or do you want to write a program that does it?
If you just want to inspect a DLL, use dumpbin from Visual Studio (actually just a wrapper around link.exe ) or Dependency Walker[^] (also in the Platform SDK).
If you want to write a program to do it, see An In-Depth Look into the Win32 PE File Format[^] from MSDN Magazine.
|
|
|
|
|
the second link might do it (I was *fo course* hoping for some EnumDllExports Win32 API function.. ) - I'm gonna study this next week, thanks
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
Hi,
I am experiencing some real trouble with a simple windows program that I am trying to create. After running the CreateDialog() function, windows returns the error "Windows class not created". I am having trouble determing what this message is really telling me.
The result of this error message is that after processing the WM_SETFONT message inside the DlgProc for the Dialog Box that it creates, Windows always processes the WM_DESTROY instead of the WM_INITDIALOG which is the next message that my other working windows programs processes which creates and displays the dialog box. I have posted my WinAPI function below:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
int nCmdShow)
{
MSG msg;
HWND mainWnd;
hInst = hInstance; // Make instance available globally
InitCommonControls();
// Create a dummy window so the dialog box can have a parent window, then
// create the dialog box itself.
mainWnd = CreateWindow("", "", 0, 0, 0, 0, 0, NULL,(HMENU)-1, hInstance, 0);
MainDlgBox = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_AURACONNECT), mainWnd, (DLGPROC)DlgProc);
DWORD Err = GetLastError();
SetClassLong(mainWnd,GCL_HICON,IDI_EXE);
// Standard Windows message loop
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
I understand that I probably don't need to create a dummy window to create a dialog box. Also, I can't post my DlgProc because it is so large and long, but is this the most likely source of this error?
Thank you for anyone who can offer any help.
Joe
|
|
|
|
|
Can you post the code of the DlgProc ?
Please use pre tags to post code:
<pre>
...your code here...
</pre>
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Ok, its pretty long, but here you go.
<br />
<br />
LRESULT CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
<br />
switch(uMsg) <br />
{<br />
<br />
case WM_INITDIALOG:<br />
<br />
return TRUE;<br />
<br />
case WM_COMMAND:<br />
switch(LOWORD(wParam)) <br />
{<br />
<br />
case IDCANCEL:<br />
<br />
DestroyWindow(MainDlgBox);<br />
PostQuitMessage(0);<br />
<br />
return TRUE;<br />
<br />
case IDC_SETIPADDR:
<br />
SendDlgItemMessage(MainDlgBox, IDC_IPADDRESS, IPM_GETADDRESS, 0, (LPARAM)(LPDWORD)NewAddr);<br />
<br />
wsprintf(strAddr,"%d",NewAddr);<br />
<br />
SendCommand(&DataSocket, SET_IP_ADDRESS, sizeof(CommandStruct), messageFromHost);<br />
<br />
strAddr[cSetIP.length] = '\r';<br />
<br />
SendCommand(&DataSocket, strAddr, strlen(strAddr), messageFromHost); <br />
<br />
MessageBox(NULL,"IP Address has been changed sucessfully","Address Changed",MB_OK);<br />
<br />
return TRUE;<br />
<br />
<br />
case IDC_SETIPMASK:<br />
<br />
SendDlgItemMessage(MainDlgBox, IDC_IPMASK, IPM_GETADDRESS, 0, (LPARAM)(LPDWORD)NewMask);<br />
<br />
wsprintf(strAddr,"%d",ConnectAddr);<br />
<br />
SendCommand(&DataSocket, SET_IP_MASK, sizeof(CommandStruct), messageFromHost);<br />
<br />
strAddr[cSetMask.length] = '\r';<br />
<br />
SendCommand(&DataSocket, strAddr, strlen(strAddr), messageFromHost); <br />
<br />
MessageBox(NULL,"IP Mask has been changed sucessfully","Address Changed",MB_OK);<br />
<br />
return TRUE;<br />
<br />
<br />
case IDC_CONNECTBTN:<br />
<br />
WSAStartup(MAKEWORD(2, 0), &wsaData);<br />
<br />
SendDlgItemMessage(MainDlgBox, IDC_CONNECT, IPM_GETADDRESS,0,<br />
(LPARAM)(LPDWORD)ConnectAddr); <br />
<br />
wsprintf(strAddr,"%d",ConnectAddr);<br />
<br />
if(ConnectToSocket(MainDlgBox, &DataSocket, strAddr, DATA_PORT, WINSOCK_DATA_MESSAGE,FD_CONNECT|FD_CLOSE|FD_READ))<br />
MessageBox(NULL,"Connection attempt with AuraNET Headbox was sucessfull!","Connected with AuraNET",NULL);<br />
<br />
else<br />
{ <br />
if(MessageBox(NULL,"Connection attempt with AuraNET Headbox was unsucessfull!","Not Connected with AuraNET",MB_RETRYCANCEL) == IDRETRY)<br />
PostMessage(MainDlgBox,WM_COMMAND,(WPARAM)IDC_CONNECTBTN,0);<br />
<br />
else<br />
return TRUE;<br />
}<br />
<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_DISCONNECTBTN),TRUE);<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_SETIPADDR),TRUE);<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_SETIPMASK),TRUE);<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_GETSTATUS),TRUE);<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_CONNECTBTN),FALSE);<br />
<br />
<br />
return TRUE;<br />
<br />
case IDC_DISCONNECTBTN:
<br />
if(!DisconnectFromSocket(&DataSocket))<br />
if(MessageBox(NULL,"Attempt to disconnect was unsucessful. Press Retry to attempt to disconnect again, or Cancel to stay connected","Disconnection Failure",MB_RETRYCANCEL) == IDRETRY)<br />
PostMessage(MainDlgBox,WM_COMMAND,(WPARAM)IDC_DISCONNECTBTN,0);<br />
else<br />
return TRUE;<br />
<br />
<br />
WSACleanup();<br />
<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_DISCONNECTBTN),FALSE);<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_SETIPADDR),FALSE);<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_SETIPMASK),FALSE);<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_GETSTATUS),FALSE);<br />
EnableWindow(GetDlgItem(MainDlgBox,IDC_CONNECTBTN),TRUE);<br />
<br />
<br />
return TRUE;
<br />
<br />
case IDC_PAIR:<br />
<br />
SendCommand(&DataSocket, SETUP_PAIR, sizeof(CommandStruct), messageFromHost);<br />
<br />
return TRUE;<br />
<br />
<br />
}<br />
<br />
return TRUE;<br />
<br />
case WINSOCK_DATA_MESSAGE:<br />
<br />
WinsockHeadboxDataMessageLoop(MainDlgBox, wParam , lParam);<br />
<br />
return TRUE;<br />
}<br />
return FALSE; <br />
<br />
}<br />
<br />
Thank you for looking at this.
|
|
|
|
|
Sorry for the delay, but rebuilding a project with that code took a bit of time.
Anyway I don't get any error on my system, where CreateDialog works correctly.
However, MSDN recommends, for modeless dialog, the following behaviour:
while (GetMessage(&msg, NULL, NULL, NULL))
{
if (!IsWindow(hwndGoto) || !IsDialogMessage(hwndGoto, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
to avoid processing not-dialog messages (hwndGoto is the dialog HWND, in the above snippet). I don't know if that helps you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
if you can build a project with no error on your system would you consider zipping it up and sending it to me/ posting it to see where we differ?
|
|
|
|
|
TheDelChop wrote: would you consider zipping it up and sending it to me
Yes, of course (by the way I need you e-mail address)
TheDelChop wrote: posting it
I don't know how if it is possible to post zip files via the forum.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
JDelCioppio@astromed.com
Thank you so much,
Joe
|
|
|
|
|
Did you try my suggestion in the reply to your other post?
Try changing
SetClassLong(mainWnd,GCL_HICON,IDI_EXE);
to
SetClassLong(mainWnd,GCL_HICON,LoadIcon(hInstance, MAKEINTRESOURCE(IDI_EXE));
|
|
|
|
|
Oops...
Should be
SetClassLongPtr(mainWnd, GCL_HICON, (LONG_PTR)LoadIcon(hInstance, MAKEINTRESOURCE(IDI_EXE)));
And your parent window has no window class registered for it?
Try making the dialog style overlapped and create it with parent HWND = NULL.
Mark
|
|
|
|
|
I have a USB tool that I gets out of sync with the USB handle and locks up my system. Is there a way to set a timer event prior to the execution of the action that sometimes hangs. This way, if it hangs for a give period of time, in the timer event I could abort the commands and reset the tool.
Eric
|
|
|
|
|
I think your tool will hang the timer too (timers act through windows messages).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
How do i capture video without using ICaptureBUilder?
|
|
|
|
|
Hi!!
i am using two method and i have declared variable out side of my method and that variable i am using in both method like ( Cstring mypath)..
Cstring mypath;
void confwebd()
{
mypath = dlg.str ( here i am retriving value "str" from dialouge box and is equal to mypath)
}
Void Webdocu()
{
Here i am using value from Void confwebd ( ie mypath)
}
but when u recall void Webdocu, then value of mypath( in void webdocu ) is not equal to original it was.It changed..
How i can make as original it was... ??
i am not sure, may be have to make global value or what ?? if yes then how?
I know.. it bit complicated to understand but...
Thanking you
Shah Satish
|
|
|
|
|
Using global is very bad practice.
And this is not complete code for sure. Post complete code if possible. That will help others to understand problem easily.
|
|
|
|
|
Hi!!
This is the code of my project..For exm..First time when i call function then
webdocupath = D:shah\myproject\webdocu\parth...ok now when i will call second time then
D:shah\myproject\webdocu
and so on..
I want at any time webdocupath =D:shah\myproject\webdocu\parth
CString webdocupath,pmysection;
void Confwebd()
{
// TODO: Implement the command
CString szIniFileName,ResFilePath;
GetModuleFileName(hArxInstance,szIniFileName.GetBuffer(MAX_PATH), MAX_PATH);
szIniFileName.ReleaseBuffer();
szIniFileName = szIniFileName.Left(szIniFileName.ReverseFind(_T('\\')) +1) + _T("WebDokuConf.ini");
// When resource from this ARX app is needed, just
// instantiate a local CAcModuleResourceOverride
//CAcModuleResourceOverride resOverride;
CConfWebD dlg(CWnd::FromHandle(adsw_acadMainWnd()));
dlg.m_strFileName = szIniFileName;
//SendDlgItemMessage(dlg,IDC_WEBDLIST,CB_GETCURSEL,0,0);
if(dlg.DoModal() == IDOK)
{
pmysection = dlg.str;
webdocupath = dlg.pstr2;
}
}
void Webdocu()
{
ads_name en;
ads_point pt;
AcDbObjectId entId1;
AcDbEntity *pEnt1;
int rc = acedEntSel(NULL,en,pt);
switch(rc)
{
case RTERROR :
acutPrintf(_T("Invalid object."));
return;
break;
case RTCAN :
acutPrintf(_T("User canceled."));
return;
break;
}
AcDbMText *myText;
AcDbBlockReference *pMyBlock;
acdbGetObjectId(entId1, en);
acdbOpenAcDbEntity(pEnt1,entId1,AcDb::kForRead);
acutPrintf(_T("\nClass is:"));
acutPrintf(pEnt1->isA()->name());
if((pEnt1->isKindOf(AcDbBlockReference::desc()))){
pMyBlock = AcDbBlockReference::cast(pEnt1);
acutPrintf(_T("\nSelected Object is block:"));
// Now get the attribs in the block
AcDbObjectIterator *pAttrIt;
AcDbAttribute *pAttrib;
pAttrIt= pMyBlock->attributeIterator();
CString x1, x2;
for (pAttrIt->start(); !pAttrIt->done(); pAttrIt->step()) {
pMyBlock->openAttribute(pAttrib,pAttrIt->objectId(),AcDb::kForRead,Adesk::kFalse);
x1 = pAttrib->textString();
acutPrintf(x1);
acutPrintf(_T("\n"));
pAttrib->close();
}
acutPrintf(_T("\n"));
}
if ((pEnt1->isKindOf(AcDbMText::desc()))){
myText = AcDbMText::cast(pEnt1);
acutPrintf(_T("\nSelected Text is:"));
acutPrintf(myText->contents());
pEnt1->close();
CString mywebdocupath,path1;
webdocupath = webdocupath.Left(webdocupath.ReverseFind(_T('\\')));
path1 = webdocupath.Left(webdocupath.ReverseFind(_T('\\')) + 1)+_T("WebDoku\\");
mywebdocupath = path1 +_T("loopo\\WG_LL.txt");
CString LoopListFile (mywebdocupath);
CStdioFile LoopList;
CFileException e;
CString FileName1,Filename2,Path;
if(LoopList.Open(LoopListFile,CFile::modeRead,&e)){
CString Oneline(""),LoopName(""),FileName("");
int pos1,pos2;
for (int i = 0; i < 4; i++){
while(LoopList.ReadString(Oneline)){
pos1 = Oneline.Find(_T("\1"));
FileName =Oneline.Mid(pos1 +1);
pos2 = FileName.Find(_T("\1"));
if(pos2>0){
FileName1 = FileName.Mid(pos2+1);
}
if(pos1 > 0){
LoopName = Oneline.Left(pos1);
if(LoopName.CompareNoCase(myText->contents()) == 0){
acutPrintf(_T("\nStrings are equal"));
FileName = path1 + FileName1;
ShellExecute(NULL,(_T("open")),(FileName),NULL,NULL,SW_SHOWNORMAL);
return;
break;
}
}
}
}
acutPrintf(_T("\nStrings are not equal"));
}
acutPrintf(_T("\nThere is no selected text in "));
acutPrintf(pmysection);
acutPrintf(_T(" section"));
LoopList.Close();
return;
}
}
Shah Satish
|
|
|
|
|
Shah Satish wrote: Here i am using value from Void confwebd ( ie mypath)
Are you assigning it a new value?
Shah Satish wrote: ...may be have to make global value...
Based on the code snippet you've shown, it already is global.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Nop..I am not assigning new value.
|
|
|
|
|
You said that the contents changed. What is inside ?
If you don't assign a new value and the contents changed, that means you have a buffer overflow somewhere.
|
|
|
|
|
Hi guys. I just have a quick question about the declaration of the socket function bind and the sockaddr_in structure. Both declarations are given below.
int bind (SOCKET s, const struct sockaddr * saddr, int namelen);
struct sockaddr_in
{
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
}
My question is: What purpose does the 'struct' keyword serve WITHIN these declarations. (the part in bold above) I've never seen this use of the 'struct' keyword before. Thanks in advance.
|
|
|
|
|
Well this one is needed as far as I knnow to store the adress you want to listen, f.ex.
<br />
SOCKADDR_IN lSockAddr;<br />
memset(&lSockAddr,0, sizeof(lSockAddr));<br />
lSockAddr.sin_family = AF_INET;<br />
lSockAddr.sin_port = htons(8500);<br />
lSockAddr.sin_addr.s_addr = INADDR_ANY;
and afterwards you can check if all initialize went OK with
<br />
if(lSockAddr.sin_addr.s_addr ==INADDR_NONE)<br />
|
|
|
|
|
Sorry. Maybe I wasn't clear about my problem. I'm not asking how to use the bind function or the sockaddr_in structure. I'm just curious why they are declared the way they are. i.e., why is the 'struct' keyword needed in the places I have in bold. It seems to me like it's not really necessary. I'm sure I'm wrong but I don't understand why.
|
|
|
|
|