|
Hi,
I created a MFC AppWizard dll(MFC Extension dll) with a single function which i have defined in Export section of .def file. The function has only 2 parameters:HWND and CString. I'm calling the dll from an application. The function executes well and gives the expected result. But when i come out of the function, I'm getting exception:
"The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling
convention".
I tired giving _MSWIN_ and _WIN32 in C/C++ tab. But it is not working. The dll uses CxImage downloaded from codeproject.
What could be the problem?
Thanks & Regards,
Sanju.
|
|
|
|
|
It is because the part that call your function doesn't have the same calling convention as the one of your function. You are probably calling the function from a VB program right ?
To solve the issue, simply add a __stdcall before your function.
void __stdcall MyFunction();
See here[^]
|
|
|
|
|
Hi ,
Thank you. It worked.
The calling application also was MFC appln.
Thanks & Regards,
sanju.
|
|
|
|
|
i have put listview in my one child window when i click on the listitem it will open new window(showwindow).
but the window i got is not updated why ?
how can i update ?
please refer the follwoing code.
well i have put the UpdateWindow(hwndTagEditorDlg); but its not working what should i do?
1)
LRESULT CALLBACK GlobaListProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
.
.
.
.
case WM_NOTIFY:
{
.
.
.
.
if(((LPNMHDR)lParam)->code == NM_CLICK)
{
iSelect=SendMessage(hList,LVM_GETNEXTITEM,-1,LVNI_FOCUSED);
if(iSelect==-1)
{
break;
}
index=iSelect;
ShowWindow(hWndinoutfiledir,SW_HIDE);
ShowWindow(hwndEncrypt,SW_HIDE);
//Hide File Split window.
ShowWindow(hwndSplit,SW_HIDE);
//Hide encoder window.
ShowWindow(hwndUpload,SW_HIDE);
ShowWindow(hwndTagEditorDlg ,SW_SHOW);<br />
UpdateWindow(hwndTagEditorDlg);
}
}
//on the click of the item the new widnow proc is here it should display all the empty control but it didn't
LRESULT CALLBACK TagEditorProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
Utility util;
switch(message)
{
case WM_INITDIALOG:
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_SAVE_TAG:
_ResideId3TagForSelectedFile(hDlg);
MessageBox(hDlg,_T("You file has been saved"),_T("encoder"),0);
break;
}
break;
}
return FALSE;
}
void _ResideId3TagForSelectedFile(HWND hDlg)
{
//std::vector multiset <string,string,string,string,string,string,string,string,string,string> TAG3 t; //it is now class
//TagEditor _ProtectSet[MAX_PATH]; //it's made global
static int i=0;
Utility util;
TCHAR buff[MAX_PATH];
ListView_GetItemText(hList,index,0,(LPWSTR)&buff,MAX_PATH);
std::wstring buff_input(buff);
std::string compare(buff_input.begin(),buff_input.end());
WCHAR w_Artist[MAX_PATH],w_Title[MAX_PATH],w_Album[MAX_PATH],w_Year[MAX_PATH],w_Copyright[MAX_PATH],w_Author[MAX_PATH];
WCHAR w_Gener[MAX_PATH],w_Desc[MAX_PATH];
string str_Artist,str_Title,str_Album,str_Year,str_Copyright,str_Authour,str_Gener,str_Desc;
GetDlgItemText(hDlg,IDC_EDIT_ARTIST,w_Artist,MAX_PATH);
GetDlgItemText(hDlg,IDC_EDIT_TITLE,w_Title,MAX_PATH);
GetDlgItemText(hDlg,IDC_EDIT_ALBUM,w_Album,MAX_PATH);
GetDlgItemText(hDlg,IDC_EDIT_YEAR,w_Year,MAX_PATH);
GetDlgItemText(hDlg,IDC_EDIT_COPYRIGHT,w_Copyright,MAX_PATH);
GetDlgItemText(hDlg,IDC_EDIT_AUTHOR,w_Author,MAX_PATH);
GetDlgItemText(hDlg,IDC_EDIT_GENRE,w_Gener,MAX_PATH);
GetDlgItemText(hDlg,IDC_EDIT_DESCRIPTION,w_Desc,MAX_PATH);
str_Artist=util.ConvertWCHARToString(w_Artist);
str_Title=util.ConvertWCHARToString(w_Title);
str_Album=util.ConvertWCHARToString(w_Album);
str_Year=util.ConvertWCHARToString(w_Year);
str_Copyright=util.ConvertWCHARToString(w_Copyright);
str_Authour=util.ConvertWCHARToString(w_Author);
str_Gener=util.ConvertWCHARToString(w_Gener);
str_Desc=util.ConvertWCHARToString(w_Desc);
//this will stored values in the object _ProtectSet[i++].Exchangedata(index,compare,str_Artist,str_Title,str_Year,str_Album,str_Copyright,str_Authour,str_Gener,str_Desc);
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2)i would like to ask you the second thing i read the xml file in which it will display
all the tags(bascially xml values related with Edittextbox) when user click on the listitem.
where should i intialize the object of that class first time when application load and put the data which i have fetch from the XML file.
so when user click on the old file which already display in the listview which is also fecth from xml file. it will also show the tags as respectively.
if nessary i will Ready to justify the xml file
|
|
|
|
|
I am currently working on a Pioneer Robot, and I would like ton install a gps receiver on it. I want to work with the Holux GPS receiver (211 series), which is an USB one. But I am not a programmer and I absolutely don't know how to communicate with it. I work under Linux and i would like to initialize the receiver, communicate with it and gather data from it (position, speed, etc). Maybe could one of you help me with my problem, giving me a C++ code that I could use, or a website link on which I could find what I am looking for.
I thank you in advance (and please excuse my english, but I am French ).
A. G.
|
|
|
|
|
If you go to the manufacturer website and download the manual:
http://www.holux-uk.com/Products/gr-211/download.shtml[^]
you will see that you need to install a USB driver (also available on manufacturer website).
The USB driver creates a virtual COM port.
The unit sends NMEA strings to the virtual COM port.
There are a lot of examples out there on reading data from a COM port.
This is Windows programming website and, although many here can/do write code for unix based systems, you won't find any linux specific examples here.
There are a number of GPS examples here though that you could use to help parse the NMEA strings.
Do a search here for "GPS NMEA".
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi
All
I have developed project in VC++ 6.0 but now i want to migrate it to VC++.Net so what are steps i needed to follow to run project in VC++ .Net.
Regards
Atool
Atool
|
|
|
|
|
When you want to open a old project on the vs2005 it says do you want to get backup and also you can see steps convert and a reposrt of convert
|
|
|
|
|
You want to convert it to the managed version? or convert it to 7.1, 8.0 unmanaged compiler version?
Dario: How is "directory" in French? (I mean a file system directory).
John Simmons: "zee file holdaire thingie"
|
|
|
|
|
1. Load the .dsw file in VC7 or 8 (whichever you have)
2. Build
3. Fix any compiler errors - you'll likely have some since the compilers in 7 and 8 have much better standard compliance.
|
|
|
|
|
Hi i Have written a project in mfc/c++ in vc.net 2005 compiler but cannot make setup for it. As far as i know we have Install shield in vc6 to make the mfc setup but can't find such in vc.net .
I will be grateful to be answered
|
|
|
|
|
|
Hi,
How i can get cooridinates and size of area on IE window where IE display html pages ?
I was try IWebBrowser2->getTop,getLeft,getWidht,getHeight but it's returns values for entire IE window.
How i can get same but only for area (MSHTML ??) where IE render and show web page ?
Thanx for help !
|
|
|
|
|
You could try it with FindWindow() using "Internet Explorer_Server" as the class name and the title of the page as the window name.
|
|
|
|
|
WalderMort wrote: You could try it with FindWindow() using "Internet Explorer_Server"
i think he should find for window with class name "IEFrame" cause its the top level window and "Internet Explorer_Server" is a child of that. Right?
nave
|
|
|
|
|
possibly, it was just a suggestion. However in IE7 the IEFrame class will contain tabbed windows, so either way the code would have to account for different versions and pages.
|
|
|
|
|
amsdev wrote: How i can get cooridinates and size of area on IE window where IE display html pages
u can get the handle of the main window using the get_HWND() function. Now enumerate the child windows, using EnumChildWindows or GetWindow function. Check the clas name of the window is "Internet Explorer_Server". You can get class name using function GetClassName(). If the class name matches, Use GetWindowRect to get the coordinates.
nave
|
|
|
|
|
Hi experts
I write a recursive program to read entries from a file .
First i take 512 entries in a buffer then i read them .
But after reading app. 1000 of entreis the "new" operator does not allocate memory to buffer. It display a exception
"Unhandled exception at 0x7c90eddc in PST_OFFICE97.exe: 0xC0000005: Access violation writing location 0x00030f18."
when i look at 0x00030f18 it shows bytes filled with highlighted "?".
what is the problem ?
|
|
|
|
|
You need to post some code
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
BOOL Message::TableofOffset_Index_Pointer(DWORD dwOffsetOfTable)
{
cout<<hex<<dwoffsetoftable<<endl;
dword="" offset="0ul;
" bool="" flag="false;
" struct="" firsttableoffset="" *prev_table_offset="NULL;
" if(dwoffsetoftable="=0x115d5200)//0x114d9400)
" getchar();
="" if(message::readfilebyte(dwoffsetoftable,0x200))
="" memcpy(&offset,m_pbytfilebuffer+skip_bytes,4);
........
.......
.......
="" memcpy(&first_table_offset-="">st_dwTableId,m_pbytFileBuffer+i,4);
memcpy(&First_Table_Offset->st_dwUnknown,m_pbytFileBuffer+i+BytesToRead,4);
memcpy(&First_Table_Offset->st_dwOffsetOfTable,m_pbytFileBuffer+i+(BytesToRead*2),4);
i=BytesToRead*3;
........
.......
.......
dwOffset=Tmp->st_dwOffsetOfTable;
Tmp=Tmp->Next;
delete[]m_pbytFileBuffer;
m_pbytFileBuffer;
Message::TableofOffset_Index_Pointer(dwOffset);
///////calling same function
return true;
}
|
|
|
|
|
So how does the recursion end?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How can i combine a LPCSTR with an int resulting in a LPCSTR.
E.g.
LPCSTR test = "Count = ";
int count = 5;
And I want a LPCSTR to be equal to "Count = 5".
|
|
|
|
|
The best way to do this is to use a wrapper like std::string, or CString. The C way to do this, is to use string manipulation methods. The method that gets a string from a number is sprintf. The method to combine strings is strcat.
strcat(test, sprintf("%d", count));
Here are the wrinkles:
1 - you say test is a LPCSTR. C stands for const, so it can't be changed
2 - this method does not allocate memory, test needs to have enough space allocated after the null terminator to make room for a copy of the number string.
3 - I did this inline, but that will leak memory, you need to make a copy of the string with the number, allocate memory to a new string that includes enough space for both strings, then use strcpy to copy the first one over, and strcat to copy over the second.
4 - if you're using VS2005, you'll need to use the new 'safe' versions or you will get warnings
So much easier to use C++.
ostringstream ss;
ss << "Count=" << 5;
string s= ss.str();
Something like that.
http://www.codeproject.com/vcpp/stl/ostringstream.asp[^]
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all,
I have used Registered ActiveX Controls in VC++ 6.0 such as
Microsoft Forms 2.0 Label.
Microsoft Forms 2.0 Image.
Microsoft Forms 2.0 CheckBox etc..
In some of the systems, when i run the exe, it will not display these components.
What is the problem. Please help me.
Thanks in Advance.
|
|
|
|
|
The ActiveX controls must be registered/installed in each machine in which you will use your app.
this is the main reason why I always try to not use them. Of course some times the only solution is using some of them and installing/registering them in each computer.
Hope this helps.
|
|
|
|
|