|
I'm having problem with my backend, my visual basic 6.0 program dont work, the winsock control doesn't have the IR protocol unlike its eVB counterpart, pls help me on this.
|
|
|
|
|
Winsock does support IrDA if any only if you have an IRDA adapter installed in the machine and it's drivers are loaded, and you have the IR protocol installed in the Network Settings.
Also, some IR ports only show up as Serial devices, not network...
The Winsock IRDA documentation starts here[^].
RageInTheMachine9532
|
|
|
|
|
can you show me the code, thank you
|
|
|
|
|
I don't have any and I haven't been able to find any VB code examples on the 'Net.
RageInTheMachine9532
|
|
|
|
|
I have an app I'm currently writing that allows users to log out but still leave the app running. When the user logs out, I want to close all child forms related to the main MDI form. Is there an easy way to do this, or do I have to code unload calls for each form?
--------------------
Tim Perry
"Remember, comments are there to make people laugh, not to help them fix your code later...because you're code is always perfect"
|
|
|
|
|
Sure. In the MDI Parent form, loop through the MdiChildren array, which contains all the child forms and call the Close method on each one (untested code!):
Dim frmChild As Form
For Each frmChild In MdiChildren
frmChild.Close()
Next
RageInTheMachine9532
|
|
|
|
|
I'm working with VBScript and WMI Win32 classes. The Win32_USBControllerDevice.Dependent property returns a reference to a CIM_LogicalDevice object. However, I am not able to (maybe because I dont know how) invoke any CIM_LogicalDevice property or method using that reference. I thought the "dot" notation would work but it gave me an error. Here is the code: (I'm trying to call the "Name" property of CIM_LogicalDevice class)
<br />
Set USB_Devices = WMI_Services.ExecQuery("Select * from Win32_USBControllerDevice")<br />
For each USB_Device in USB_Devices<br />
WScript.Echo "USB Device: " & USB_Device.Dependent.Name<br />
Next<br />
The error I got is:
"ERROR: Object required: 'USB_Device.Dependent'
CODE: 800A01A8"
Can someone please help?
|
|
|
|
|
Well, you can't use a ref: object like that, as you've already found out, since the WMI provider won't resolve reference for you. But, the CIM_LogicalDevice maps to a Win32_PnPEntity object. You can use the string that Dependant returns to get at the actual device. You'll have to parse out the DeviceID, but you can use that ID to get the appropriate Win32_PnPEntity object from WMI.
RageInTheMachine9532
|
|
|
|
|
I made a small VB app to run while I play a game. The problem is, the game takes up the full screen and thus hides all the windows. It there some way to run the VB program on top of everything else, not just other windows?
|
|
|
|
|
If it's a DirectX app that runs full screen, your out of luck.
But if it's running in a window, then, in VB.NET, you can set your form to be on top of all other windows by setting its TopMost property to True. If you're using VB6, then you'll have to call into the Windows API to make your window the topmost. Something like this:
Option Explicit
' Declare function calls into the Win32 API.
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
' Define the constants used by SetWindowPos.
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOZORDER = &H4
Public Const SWP_NOREDRAW = &H8
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40
Public Const SWP_HIDEWINDOW = &H80
'
' Make our window the topmost window on the screen.
'
Public Sub MakeTopMostWindow(frmForm As Form)
With frmForm
' Tag our window as as TopMost and not to swap its position
' in the Z-Order with any other window
SetWindowPos frmForm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_NOSIZE Or SWP_NOMOVE
End With
End Sub
RageInTheMachine9532
|
|
|
|
|
I'm not sure if it's directX, but it does take up the full screen and is NOT windowed. Thanks anyway.
|
|
|
|
|
I have a VB6 AX control with a contained ADO grid. I need to expose the grid property page but i cannot find how.
Any idea?
Thanks
Gabriel
|
|
|
|
|
Does anyone use VB.NET standard rather than Visuual Studio .NET?
Is there a downside if you only want to write apps in VB.NET?
|
|
|
|
|
No down side really, but it depends on the type of apps you want to write. The Standard Edition is the entry level version of VB.NET. You loose all the Enterprise features, including the ability to develop for PocketPC, SourceSafe, , and gain none of the Academic version features.
RageInTheMachine9532
|
|
|
|
|
Hiya,
I've created a simple vb.net windows service, and I'm trying to peroidcally run a batch file as part of the service but it's not working..
Here's the code
Dim myProcess As New Process()
myProcess.StartInfo.FileName = "c:\batchfile.bat"
myProcess.Start()
Any ideas why this will not work? No errors are thrown and when stepping throught the code with the debugger, all seems well.
Cheers,
stuart
p.s. I'm an amatuer.
|
|
|
|
|
It doesn't thow an Exception because the code can sucessfully launch the batch file. It is the batch file that is probably having the problem because of NTFS rights issues.
Is you service running under the LocalSystem account or is it running under a user account? Does this account have the proper rights to the files your trying to manipulate? Does this batch file do something with a Network file? Local System will not have the rights to anything that is on a network share...
RageInTheMachine9532
|
|
|
|
|
|
Dear all,
I am getting to grips with writing VS.NET add-ins with a view to publishing an article on here. I am considering making the add-in modular, that it dynamically detects and adds new features rather than having to run the whole installation again, kind of like a snap-in. Anyway, that's by the by.
Complete the statement below with a genuine requirement and I will see what I can do to add your wishes into my add-in.
I wish I had an add-in (for VB or C#) that......
I have a couple of features in there right now:
1. Select text and wrap in new region
Dim a as string
a = "hello"
becomes...
#Region "My Region"
Dim a as string
a = "hello"
#end region
2. Paste a SQL statement in to code and have its individual lines added to a string variable
SELECT *
FROM mytables
ORDER BY 1
becomes...
Dim lSQL as string
lSQL = "SELECT *" + "\r\n";
lSQL += "...
3. Select member variables of a class and the add-in creates the property let/get code for you
4. Select a database and some tables and the add-in creates classes whose members map to columns on the tables.
Any more?
Chris
Nursey
|
|
|
|
|
I am writing a program to solve the rubik's cube.
For details of the algorithm, google "cube explorer"
My problem is this, I need to write 2 HUGE tables, but the values in each position in the table are either 0,1,2 or 3. The smallest datatype I know of is the byte, but this (2186)x(2047)x(494) table gives me an error of system out of memory.
Could someone help me out?
Thanks
Fox
|
|
|
|
|
At 1 byte per element, this would require about 2.2 GIGABYTES of storage.
You can get away with mapping multiple bytes into an array of 69,078,830 UInt32 elements. This will allow you to get 4 of your bytes into one UInt32.
Since the values 0, 1, 2, and 3 will fit into 2 bits, you could map this into the UInt32 even more efficiently and pack 16 values into one UInt32.
In either case, you'll have to manage the array indexing yourself. The easiest way to do this is to create a class that can create an internal array of UInt32's that will hold the capacity of 2,210,522,548 two bit values that you need. Then you'll have to expose an Index property that can take 3 arguments as index values in your 3D array. You'll use those values to caluclate which UInt32 has the two bits your looking for.
RageInTheMachine9532
|
|
|
|
|
Any ideas how to specify a start page for the webbrowser control, similar to IE's "Start Page" feature? The WebBrowser control only seems to want to load pages from an open dialogue or a button, it doesn't like code in the form load section.
Any help would be great!
|
|
|
|
|
I am getting a little closer by adding the following to the Sub New ()
brweb.navigate({url}) ' {url} being a string
Except now the webbrowser control hangs with the hourglass. Can't figure it out.
|
|
|
|
|
..and register it on the server.
I am really struggeling now, and hope someone can help me.
I am using the SmtpMail class and MailMessage Class to send mail, but I want some response from the server too, and after A LOT OF READING I came to the conclusion that I need to make a transport event sink that is triggered for every mail I send to the smtp server.
I also came to the conclusion that I have to use the smtp Message Envelope Fields to be able to get the info I need back from the smtp server. I ie. need to now if the connection to the server was ok every time I try to send a mail, if a mail was successfully sent or not, and to fetch the headers of the mail and write them also to the log file. I am not sending mail to the drop directory.
I even (after a long research) found found an example in the msdn using VB or VB script to fetch values from the server in so matter and write it to a log file, but I cant get it to work and there are several things I do not understand.
The msdn mentions the use of the script smtpreg.vbs to register a script containing a OnArrival event on the server. And the script is to simplify using SEO(Server Extension Objects), but they never mention what to use if you do not want to use the script. This is so frustrating.
I am not using scripting, I am programming a windows application in VB.NET. Is the example for VB 6, or what am I missing ?
This is the example:
Creating an SMTP Message Log File
The following example of an event sink creates a file called Events.txt and then copies the From, To, Subject headers and TextBody of the messages into the file. Each message that arrives is appended to the file. The format of the file is as follows:
From: (from header)
To: (to header)
Subject: (subject of message)
From: (from header)
To: (to header)
Subject: (subject of message)
...
The following example is presented in two versions: using C++ and the Microsoft® Active Template Library (ATL) and using Microsoft® Visual Basic®. See Sink Example Using C++ and ATL and Sink Example Using Visual Basic.
© 2000-2001 Microsoft Corporation. All rights reserved.
CDO for Windows 2000
Sink Example Using Visual Basic
The following sink example uses Visual Basic to create the log file. To function, the project (Microsoft® ActiveX® DLL) requires a reference set to the following type libraries:
· Microsoft® ActiveX® Data Objects 2.5 Library (MSADO15.DLL)
· Microsoft® CDO for Windows® 2000 Library (CDOSYS.DLL)
· Microsoft® Server Extension Object COM Library (SEO.DLL)
· Microsoft® Scripting Runtime (SCRRUN.DLL)
Implements CDO.ISMTPOnArrival<br />
Implements IEventIsCacheable<br />
<br />
Private Sub IEventIsCacheable_IsCacheable()<br />
' just returns S_OK<br />
End Sub<br />
<br />
Private Sub ISMTPOnArrival_OnArrival(ByVal Msg As CDO.Message, EventStatus As CDO.CdoEventStatus)<br />
Dim fs As New Scripting.FileSystemObject<br />
Dim file As Scripting.TextStream<br />
Set file = fs.OpenTextFile("e:\script\test.log", ForAppending, True )<br />
file.Write "From: " & Msg.From & vbCrLf<br />
file.Write "To: " & Msg.To & vbCrLf<br />
file.Write "Subject: " & Msg.Subject & vbCrLf & vbCrLf<br />
file.Write Msg.TextBody & vbCrLf & vbCrLf<br />
file.Close<br />
EventStatus = cdoRunNextSink<br />
End Sub
I do not understand the event structure and how to use the interfaces.
In Visual Studio when I implement CDO.ISMTPOnArrival and SEOLib.IEventIsCacheable, I Can select ISMTPOnArrival and then select CDO.onArrival from the combo boxes in the code window and this then become my sub-structure:
Public Sub OnArrival(ByVal Msg As CDO.Message, ByRef EventStatus As CDO.CdoEventStatus) Implements CDO.ISMTPOnArrival.OnArrival
Why is this different from the structure in the example and How do I make the event in the example to work?
Is the reference to SEOLib automatically supposed to register the vb class that contains OnArrival
on the server ? Or do I need to do semething more to get the sink registered ?
Can anybody help me please ?
|
|
|
|
|
hopefully im not being an annoyance with my repost but i cant seem to find anything for help with this.
can someone please help me out on using MIDI instruments with vb.net? like, on how to make a simple MIDI piano player-type program, but in vb.net? i have downloaded some of the midi examples on CP, but most dont work because i dont have VS6 or 7, which is what the examples i can find are in. also they are mostly written in C# or C++, im sure there is a way to do it in vb.net... right?
i want to rebuild my midi-based guitar assistant-type of program i wrote afew years ago in vb6, into vb.net
Thanks in advance.
------------------------
Jordan.
III
|
|
|
|
|
Im using VB.Net and loading a page that has a high-res image as its background. Depending on certain variables "different" images are then overlaid on top of this. (up to 10 images)
My problem is that when the page loads it flickers for a slight second as the secondary images are loaded over the primary image.
Is there any way to cut down on this flickering ? Bouble buffering springs to mind but I dont have a clue where to start...
Any help at all will be greatfully recived.
All the best Paul.
|
|
|
|