|
Hi
I want to create a dynamic link library in Visual C++ for use in Visual Basic.
From VB i pass a String to the dll, so far so good, but now i want to return another String to the VB-program. My problem is now the memory access error, that occurs in the running VB programm.
What types in the c++dll can i return to VB, that expect a String??
thanx for your replies
|
|
|
|
|
A BSTR , I think. CComBSTR could be useful to do this.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I though about creating a Edit window in my app that when called
at runtime would catch all OutputDebugStrings that my program was
making.
After some nosing about on MSDN about catching OutPutDebugStrings i
wrote a thread function as below and called it from a menu option. The
idea was to eventually create a small window that would be updated with
any OutPutDebugStrings that were caught.
<br />
UINT catchDebugString(LPVOID param)<br />
{<br />
TCHAR myChar[1024];<br />
DWORD dwProcessId = GetCurrentProcessId();<br />
HANDLE hHandle = OpenProcess( PROCESS_ALL_ACCESS, false, dwProcessId );<br />
<br />
if ( DebugActiveProcess( dwProcessId ) == 0 )<br />
return 0;<br />
<br />
DEBUG_EVENT de;<br />
<br />
while ( WaitForDebugEvent( &de, INFINITE ) )<br />
{ <br />
if ( de.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT )<br />
{<br />
OUTPUT_DEBUG_STRING_INFO deStr = de.u.DebugString; <br />
<br />
ReadProcessMemory(hHandle, deStr.lpDebugStringData, myChar, 1024, NULL);<br />
}<br />
<br />
if ( EXIT_PROCESS_DEBUG_EVENT == de.dwDebugEventCode )<br />
break;<br />
<br />
ContinueDebugEvent( de.dwProcessId, de.dwThreadId, DBG_CONTINUE );<br />
} <br />
<br />
return 1;<br />
}<br />
All was well until i found out i cant call DebugActiveProcess( dwProcessId )
with my own process id , there by making it so i cant catch my own OutputDebugStrings.
I just wondered if anyone out there had any ideas of how i could overcome this
problem or if there is another way to catch OutputDebugStrings??
cheers
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
DebugView do that and lot more
http://www.sysinternals.com/ntw2k/freeware/debugview.shtml
U have to change ur process privilege to debug mode first if u still wanna do it
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
hey there papa... yes i am aware of debug output viewer applications but want to do this programatically..
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
|
cheers mate... I'll have a look at that, as it looks like it will provide valuable info for me..
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
Maybe Ivo Ivanov's API hooking revealed[^] can be of help here.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
cheers Joaquín.. Im just having a quick read now
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
I'm trying to draw a button and an ip address area in my active x control.
I thought I could just use the ResourceView->Dialog to add the components visually, but evidently that only allows you to manipulate the property and about box areas for activex programs.
So... my question is how do I draw, say, a simple CButton in the ondraw area of my control?
something like:
void CAChatCtrl::ondraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
CButton testButton = new Button();
CRect bBounds = new CRect( rcBounds->r - 30, rcBounds->b - 30, rcBounds->r, rcBounds->b );
testButton::Create("DrawnButon",BS_DEFPUSHBUTTON,bBounds,?,??);
}
Thanks for any help
|
|
|
|
|
Hey there guys... Just found out that if you want to get the last error of api calls then just type:
@err,hr
into the watch window... A very useful tip i thought and saves you programaticaly calling the the GetLastError api function!
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
Hi,
I've got an app (running under Win2k) with a flexgrid control in. It works fine under an Administrator, but as a normal user we have the following:
PROBLEM - Running on machines that haven't previously had msflxgrd.ocx installed results in an "Unsupported operation" message box when we try loading the app.
We are using Installer 1.1, and have tried using the flexgrid merge module, as well as distributing msflxgrd.ocx by hand.
We have definitely tried 'regsvr32 msflxgrd.ocx' too!!!!!
I've used OLEView to look at the ocx registration details. Under and administrator, it can view all the details and expand the interface leaves fine. Under a normal user it can't get any details about the ocx. It just gives the error:
"CoGetClassObject failed.
Class not registered
REGDB_E_CLASSNOTREG ($80040154)"
On machines that already have msflxgrd.ocx, it seems to work fine.
Anyone have any ideas?
TIA,
Paul.
|
|
|
|
|
could it be that the ocx isn't getting installed properly? (i.e. the administor can read the file, but normal users can't)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Can anyone explain the process of using a CTabCtrl in a Dialog Bar. I understand the process of how tab controls work and have found away to use them in dialog boxes, but i cannot work out how to use them in a dialog bar
your help would be gratefully appreciated
thankyou
steven oliver
|
|
|
|
|
stevenoliver wrote:
cannot work out how to use them in a dialog bar
I would have thought it would be the same process as using it in a CDialog ? I admit I haven't tried using it in a CDialogBar . Were you having a specific problem?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
to get a dialog bar to work correctly you have to use the CMainFrame class and not a class of its own.
To use CtabCtlr in a normal dialog you create the tabs in WM_INITDIALOG. You cannot derive WM_INIDIALOG from CMainFrame.
I am not sure which handler to use, in this case
Is there an equivalent to WM_INITDIALOG for CMainFrame??
steven
|
|
|
|
|
Ah. You could post a custom message (IDC_INIT_TABCTRL ) to the dialog bar the first time it's shown, and initialize the tab control in the handler for IDC_INIT_TABCTRL .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
thankyou.
sorry for my ignorance, i am still fairly new to mfc. Could you possibly explain how i go about doing this?
thankyou
steven oliver
|
|
|
|
|
I think my earlier response was sorta misleading (I'm not fully awake). Just override your dialog bar's OnShowWindow() and add this logic to it (after calling the base class handler):
if (!m_bTabCtrlInitialized) {
...;
m_bTabCtrlInitialized = true;
}
m_bTabCtrlInitialized is a bool member that's initialized to false in your dialog bar's constructor.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
i also cannot create a member variable for the tab control in CMainFrame. How do i go about doing that?
thankyou
steven
|
|
|
|
|
The tab control is a member of the dialog bar, not the mainframe. The mainframe is a container window and isn't associated with a dialog resource.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Re: your email, sorry I don't have a sample of a tab ctrl in a dialog bar.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I want to get bytes sent and bytes received in windows 2000, I try to use IP Helper API GetIfEntry, but it seems that the bytes sent and bytes received data is changing slowly, and another problem is the bytes sent is equal to bytes received.
Would you please tell me how to fix this problem?
Thank you very much!
The program is as the following:
int _tmain(int argc, _TCHAR* argv[])
{
cout<<"net adapters information:"<<endl<<endl;
="" pmib_ifrow="" ifrow="new" mib_if;
="" mib_ifrow="" ifrow;
="" mib_ifrow();
="" for(int="" i="1;i<2;i++)
" {
="" ifrow-="">dwIndex=i;
DWORD dret=GetIfEntry(ifrow);
if(dret!=NO_ERROR)
{
//cout<<"error index="<
|
|
|
|
|
|
*hic*
Roger Allen
Sonork 100.10016
I have a terminal disease. Its called life!
|
|
|
|