|
zhiyuan16 wrote: so how to invoke the c++ member function in one .dll
I guess only c functions exported from the dll can be called from VB.
|
|
|
|
|
thanks for your reply. i knew i need to export the c++ dll function first, and then i can call it. but i don't know how to export step by step? i got the dll already. how to export? please help me. thanks a lot
rgds
|
|
|
|
|
You can call a c function exported in a c/c++ dll from a VB application. And to export a c function all you have to do is put the following keywords in front of the function to export as shown below
extern "C" __declspec( dllexport ) void AnotherCFunc();
extern "C" - is used to avoid the name mangling
|
|
|
|
|
thanks a lot for your help. my one .dll has several classes, so how i can use these funtion properly in vb. thanks a lot
|
|
|
|
|
As I said before you cannot call a c++ class's member function from a vb app.
|
|
|
|
|
thanks, how i can export the functions of dll step by step? thanks a lot
|
|
|
|
|
If you haven't DLL source code then you can't. However, you may develop (with C/C++ ) a new DLL that will act as wrapper of the original one (i.e. an adapter [^]). For details on building a VB6 callable DLL , see this great article series [^].
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi ,
In my application I am using NOTIFYICONDATA structure to show tool tip. here the szTip can only contain 128 charecter. Is there any other way to use more charecters in tool tip?
Thanks in advance.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
birajendu wrote: Is there any other way to use more charecters in tool tip?
Not using the standard shell32 tooltip. I'm afraid that you will have to use a custom tooltip if you require additional features. There are a few articles here on codeproject which could be used.
CPPToolTip v2.1[^]
Custom ToolTips for MFC Projects[^]
Best Wishes,
-David Delaune
|
|
|
|
|
This may help you
http://www.codeproject.com/KB/toolbars/tooltipsindialog.aspx
|
|
|
|
|
By the way szTip can only contain 64 characters and not 128.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I've got an MFC application writed in c++, it is a dialog-based project. I can't find anywere in the internet a solution for my problem. I've got a dialog window were i created a buttons. Also I've got two others dialog windows. I don't now how to make to open second dialog window when the button in window one will by clicked. I tried everything what i found in the internet and nothing ...
Please if any one can help me. I will be very thankfully if someone can send my or show how to do this.
HrDDD
|
|
|
|
|
in the handler of your button in dialog A (the first dialog), just create the second dialog.
for modal dialog:
void MyDialogA::OnButton()
{
MyDialogB dlg;
dlg.DoModal();
}
for modeless dialog:
class MyDialogA
{
MyDialogB* m_pDialogB;
}
void MyDialogA::OnButton()
{
if ( m_pDialogB)
delete m_pDialogB;
m_pDialogB = new MyDialogB;
m_pDialogB->Create(IDD_DIALOG_B);
m_pDialog->ShowWindow(SW_SHOW);
}
This signature was proudly tested on animals.
|
|
|
|
|
I can't find any function for calculate the time between LBUTTONDOWN and LBUTTONUP,help me ~ 
|
|
|
|
|
Here is a generic example on how to get elapsed time:
CTime startTime;
CTime endTime;
CTimeSpan elapsedTime;
On LBUTTONDOWN: startTime = CTime::GetCurrentTime();
On LBUTTONUP: endTime = CTime::GetCurrentTime();
elapsedTime = endTime - startTime;
int timeout = elapsedTime.GetSeconds();
|
|
|
|
|
wb_program wrote: I can't find any function for calculate the time between LBUTTONDOWN and LBUTTONUP,help me ~ Cool
Also probably you can use GetCurrentMessage which contains a DWORD value which gives the time the message was posted. Note that you should only call this from event handlers. So call this from mouse up and mouse down.
|
|
|
|
|
You can use 'GetDoubleClickTime' to retreive double click time for your mouse.
|
|
|
|
|
char *sConn="C:\\Documents and Settings\\Nimesh Gurung\\Desktop\\VPassignment\\Employee.mdb";
m_ptrConnection.CreateInstance(__uuidof(Connection));
m_ptrConnection->Provider = "Microsoft.Jet.OLEDB.4.0";
m_ptrConnection->Open(sConn,"Admin","",NULL);
//Create Ado recordset
m_pRS=NULL;
m_pRS.CreateInstance(__uuidof(Recordset));
m_pRS->CursorLocation=adUseClient;
char *table="SELECT * FROM EmployeeDetails";
m_pRS->Open(table,sConn,adOpenKeyset,adLockReadOnly , adCmdTable);
/
m_datagrid.putref_DataSource(NULL);
m_datagrid.putref_DataSource((LPUNKNOWN) m_pRS );
//m_datagrid.Refresh();
I am using Visual Studio 2008 and somehow can't make my code to open the recordset. Any help is much appreciated.
Many thanks in Advance
|
|
|
|
|
Given the complete and utter lack of error checking, the root cause could be any of the statements before the record set open call. Check the status values to see where the error actually occurs, and then ask your questions...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
my problem solved once I changed the char variable table to just EmployeeDetails but still want the ability to use select for more functionality.
Is it a little bit different in visual studio 2008.
|
|
|
|
|
I think it's the adCmdTable parameter - that says the command you're opening is a table. This page[^] documents the other options, while this page[^] suggests you want adCmdText if you want to use a SELECT statement as the command text.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I use a tab control in a dialog which is as a property setup window and put three dialogs into this tab control.Here is the problem,how can i destroy this three dialog and the mian dialog,return to the mian window.
|
|
|
|
|
If the dialog is modal, it will get destroyed when you click OK or Cancel.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi!
I have an application which sits in the system tray globally listening for a combination key press event (CTRL+ALT+T). Instead of opening the app by right clicking the app icon in the tray bar (clicking Open), I would like to open the app window upon CTRL+ALT+T. When that happens, sometimes (more often than not) the window loses focus/gets inactivated and I manually need to click it to regain focus.
What else besides the following lines of code can be done to force the app foreground, topmost, focused and active?
((CMyAppDlg*) AfxGetApp()->GetMainWnd())->ShowWindow(SW_SHOW);
((CMyAppDlg*) AfxGetApp()->GetMainWnd())->SetFocus();
((CMyAppDlg*) AfxGetApp()->GetMainWnd())->SetForegroundWindow();
Thx!
/T
|
|
|
|
|
The behavior of the SetForegroundWindow Function[^] can be affected by SPI_GETFOREGROUNDLOCKTIMEOUT as described in the SystemParametersInfo Function[^]
See if this works for you:
HWND hWnd = GetForegroundWindow();
DWORD dwThread = GetCurrentThreadId();
DWORD dwProcessID = GetWindowThreadProcessId(hWnd,NULL);
if(hWnd > 0)
{
AttachThreadInput(dwProcessID,dwThread,TRUE);
(AfxGetApp()->GetMainWnd())->SetForegroundWindow();
AttachThreadInput(dwProcessID,dwThread,FALSE);
}
Best Wishes,
-David Delaune
|
|
|
|