|
Assuming the C++ Dll is not compiled as a COM dll, you have to declare function prototypes in VB for the functions in the C++ dll. You must make sure to convert C++ types into the correct VB types, and use the appropriate ByVal and ByRef calling conventions.
A web search or MSDN search on "Calling Win32 API from VB" will provide you with a few zillion examples.
Robert
|
|
|
|
|
Hi Guys,
I am a >net developer. I hav a question. I need to write a program which wud call a JAVA API to make some search. I hav no idead a s to hw to call it. ken anyone help me do it??
Jobees
|
|
|
|
|
dear All
I have to made the data transaction,when the connection will be made ,connections means dial-up network beteween two systems.suppose the system A dialed then the system b will accept the connection and send the file,data to systema .now what i think,i think to create the service when the connection will be made it will activate,now my question is ,how can i know the connection is establishing,means the how cani know the incoming connections is currently connected or not from vb.net and also i want to get both ipaddress.if anybody can help me .thats very usefull for me
Ishak
|
|
|
|
|
What is the standard for commenting in VB. C# uses the summary tags I believe.
Can anyone shed some lite?
|
|
|
|
|
Doesn't VB.NET also generate XML help from the comments ? Or are you VB6 ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm using .NET
Can you provide a quick example plz.
|
|
|
|
|
I don't use VB.NET at all, ever. But in C#, if you type three slashes instead of two, you get the comment block that will convert to XML. Obviously, VB.NET does not use slashes at all.
A quick google adds this to the list of things that C# can do that VB.NET cannot, sorry. XML comments will be new in VB.NET 2005.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
OK - it's just not standard. I found an article explaining how 'with VS2005, VB users can do XML comments just like people using C#'.
I'm glad you found a solution.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
He used Google?? There is hope!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yeah, VB.NET 2002 and 2003 don't support doing this. At least without using a third party add-in, like VBCommentor. In 2005, this works just like it does in C#, only using '''.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a problem that is confusing to me...
In my VBA code inside an MS Access database, I make a two function calls to external functions in a C++ DLL. Here is how I have it setup in VBA side:
'external LIB functions<br />
Private Declare Function Convert_String_To_Geodetic Lib "C:\Work\MyDLL.dll" (ByVal strMyStr As String, ByRef Lat As Double, ByRef Lon As Double) As Long<br />
Private Declare Function Convert_Geodetic_To_String Lib "C:\Work\MyDLL.dll" (ByVal Lat As Double, ByVal Lon As Double, ByVal Precision As Long, ByVal strMyStr As String) As Long<br />
When I don't absolute path, only the second function returns values as expected - the first Convert_String_To_Geodetic ( ) does NOT. When I do absolute path, BOTH functions seem to behave ok.
Questions:
1) how can I specify a relative path to current working directory - ".\" or no path has side effect of NOT WORKING.
2) WHY does using absolute path work? If I leave path off or ".\", it knows the DLL/function but doesn't return correct value back in Lat Lon variables.
I'm totally confused
Thanks,
Johnny
|
|
|
|
|
If you specify just the filename, then the current directory is searched for the .DLL. If it's not found, the system will look in the directory specified by the SystemRoot environment variable, and if still not found, will look in the directories listed in the Path evnironment variable. If this fails, then the call will fail.
Is it possible that you have a .DLL with the same name sitting in the Path somewhere?
As a rule of thumb, it's best to keep an applications .DLL's in its Program Files directory, or a subfolder of that directory. Do NOT use absolute paths, use relative paths only because you can't guarantee that your aplication will be installed on C:.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All,
Using Notepad is a convenient method of displaying a HELP file.
Does anybody know how to control the Notepad properties once it has been invoked?
i.e how can you disable menu items and the text window in VB.NET code?
thanks
|
|
|
|
|
Wow - that's a really bad idea. What's so hard about creating your own dialog with a window to display text ? Or live with the fact that Notepad will let them change/save it.
You can control Notepad, but it's more work than you need to do, and it sure can't be done with a language as limited as VB.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
rswipe wrote:
how can you disable menu items and the text window in VB.NET code?
Since Notepad doesn't expose any kind of automation interface, you'll have great difficulty in pulling this off, in ANY language, Christian! .
Christian is correct, though. It's much quicker, and FAR easier, to build a form specifically for displaying your help file in a read-only TextBox.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Since Notepad doesn't expose any kind of automation interface, you'll have great difficulty in pulling this off, in ANY language, Christian!
True, but there are articles here on CP that do it in C++, I believe. Like I said, it's a hell of a lot of work, and a complete waste of time ( the article was proof of concept more than 'here's something useful' ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
Like I said, it's a hell of a lot of work,
I haven't seen the article, but, I'm going to guess it involves window finding and sending a bunch of messages to tell the controls to disable themselves?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
OK guys, thanks for the comments. i agree making your own dialog box isn't so difficult although getting the format right is sometimes time consuming depending on how big the help file is.
i'm all for an easy life and if there was a "one-liner" to do what i wanted then all the better.
thanks anyway.
|
|
|
|
|
I'm not quite sure what you mean by "format". But it is easy enough to place a read-only RichTextBox control on a dialog box you create. Then you can simply load your help file into the RichTextBox with the LoadFile command (RichTextBox1.LoadFile("help.rtf") ). It's a "one-liner" and unlike NotePad, you can display a RTF where you can have more than just text! If that fails to please, you could always use the HTML Help Workshop to create a help file
|
|
|
|
|
|
Hi,
The subject explains what I would like to do, but here's more detail:
I have a WinForm which contains a TreeView control and a AxWebBrowser control. When a user clicks on a TreeNode a file (placed in TreeNode.Tag) is loaded into the AxWebBrowser control. I have hidden the menus and toolbars of the AxWebBrowser control since they are not meant to be seen by the user and in this particular case, my AxWebBrowser control is used for viewing and searching documents.
Is there a way to show the Find Dialog via SendKeys (Ctrl-F) from a menu option or toolbar from my Main form? I have tried the following code:
Private Sub mnuEditFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _<br />
Handles mnuEditFind.Click<br />
SendKeys.Send("^F")<br />
End Sub
OR
Private Sub mnuEditFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _<br />
Handles mnuEditFind.Click<br />
AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_SHOWFIND, _<br />
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER)<br />
End Sub
Using either code has no effect. I believe the SendKeys method is sending the message only to the active window which is my Main form. Is there a way around this to make it work?
Any help or guidance would be much appreciated. Thanks!
|
|
|
|
|
Try using command AppActivate before sending keys "^F".
|
|
|
|
|
Hi, thanks for your reply...
I have tried AppActivate before using send keys, but since the AxWebBrowser control is embedded in the Main form along with other controls, I am having trouble setting focus or locating the process id of the control. For instance if i try something like the following:
<br />
Private Sub mnuEditFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditFind.Click<br />
Dim pi As New Process<br />
pi = Process.GetProcessById(AxWebBrowser1.HWND)<br />
AppActivate(pi.Id)<br />
SendKeys.Send("^F")<br />
End Sub<br />
I recieve an "Unspecified error". I am not having trouble giving focus to the Main form itself. I have tested SendKeys by sending "%{F4}" in code, and as expected, it closed the window.
I need to find a way to activate or set focus to the AxWebBrowser control before using SendKeys. If I click on the AxWebBrowser control when my application is running, I can easily press Ctrl-F on the keyboard and the Find Dialog will popup. But I wish to put this as a menu/toolbar option since the main user's of this application won't be very "computer savvy"
Any other suggestions? Is there some way to send a message in code or have the AxWebBrowser control listen to key events??
Thanks!
|
|
|
|
|
Just to let you know, I figure out how to use the SendKeys method! Who would have thought that SendKeys would be case sensitive! All I had to do was replace my "^F" with "^f" and now it works!
Private Sub mnuEditFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles mnuEditFind.Click<br />
'AxWebBrowser1.Select()<br />
SendKeys.Send("^f")<br />
End Sub
There is however a bug with this. For some reason, the AxWebBrowser does not activate properly in code (AxWebBrowser.Select() ). Therefore, forcing you to click on the control before allowing you to use the menu option! At times, if you do not click on the AxWebBrowser to activate it...the SendKeys method will hang your application and you won't even be able to move your mouse! I still have not found a way around this. But at least I know that send keys works now
Also, for anyone interested in an alternative method which I found (and works) but what I was trying to avoid using since it is dependent on Microsoft.mshtml:
HOW TO: Invoke the Find, View Source, and Options Dialog Boxes for the WebBrowser Control from Visual Basic .NET
|
|
|
|
|