|
Mike Nordell wrote:
Imagine any program that could access (stop) the CPU fan and burn another Athlon?
Some of them burn with the fan running normally
Crivo
Automated Credit Assessment
|
|
|
|
|
I have a data control and I need to pass in a Data object in a function's parameter. I'm the one making the function, so I can change it to a recordset, which is "ok" but it just doesnt make a whole lot of sense to do 1/2 of what i want to do outside of a function, and the rest inside of a function! (if i would pass a recordset)
So any suggestions? my boss remembers doing it but he forgot how. (uhh huh, yeah ok)
I believe it can be done, but all i want is a Data object, because that's the only thing i've really messed with in messing with Databases (i'm pretty new to VB but a veteran to C++)
Ok, thanks in advance!
~Timothy T. Rymer
http://tim.xpertz.com
http://www.digipen.edu
http://www.ttrx.com
|
|
|
|
|
I'm not sure if this is what you are looking for.... You might what to do a search for "Data aware class" on the MSDN.
Private Sub mysub(Data As Object)
End Sub
|
|
|
|
|
You are better off passing the recordset object if thats what you are going to be playing with. Otherwise you are using late binding. Something like this :
Sub DrawData(ByVal oRec as ADODB.Recordset)
Dim dField as Field
For Each dField in oRec.Fields
MsgBox dField.Value & " " & dField.Name
Next
End Function
Sub Main()
Dim oRecord as ADODB.RecordSet
Dim ssql as String
Dim oConnect As ADODB.Connection
oConnect.Open "Blah,Blah"
ssql = "SELECT * FROM table1"
oRecord.Open ssql, oConnect, adOpenForwardOnly, adLockReadOnly
DrawData(oRecord)
MsgBox "Success"
End Sub
|
|
|
|
|
One of our VB6 apps is designed to be able to print, and prints using the basic printform command.
On most printers, it prints fine, except for one, an HP 930c DeskJet. The app gives the error "Can't print form image to this type of printer". (I believe the error code is 486.)
We've tried some of the solutions found on the 'net (even the Microsoft one), but nothing has worked so far.
Anyone have this kind of problem before?
|
|
|
|
|
Hello!!!
I would like to know how I can add background to the whole Form, while the background file is a smaller than the Form size.
I don't want to create a large background which is .bmp file, but JPEG or GIF.
Thank you !!!!
Ahuva
|
|
|
|
|
Just set the Picture property of the form.
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Make a .JPEG that's the same size as your form and set it as the Picture property on your form... like David said
First Programmer: "How many bits are in a bite?"
Second Programmer: "You spelled bytes wrong."
First Programmer: *stares* "It's a joke, moron."
Second Programmer: "Joke...?"
|
|
|
|
|
Hello !!!
I need help !
I would like to know how I can operate a mp3 when an event is ocour. What is the code line ?
Thank You !!!
Ahuva
|
|
|
|
|
Help Please...!
I'm trying to add a shutdown routine to a program using the ExitWindowsEx API function. I'm running on Windows XP. The problem is that the LookUpPrivilegeValue function keeps crashing out saying : Instance of an object is not set. As far as I know I'm not referencing an object merely calling a function. Can anyone help?
Here is the code I am using:
Option Explicit On
Imports System
Imports System.Runtime.InteropServices
Public Class ShutDownAPI
Private Const EWX_LogOff As Long = 0
Private Const EWX_SHUTDOWN As Long = 1
Private Const EWX_REBOOT As Long = 2
Private Const EWX_FORCE As Long = 4
Private Const EWX_POWEROFF As Long = 8
<dllimport("user32.dll")> Public Shared Function ExitWindowsEx(ByVal dwOptions As Long, ByVal dwReserved As Long) As Long
End Function
<dllimport("kernel32.dll")> Public Shared Function GetLastError() As Long
End Function
<dllimport("kernel32.dll")> Public Shared Function GetVersion() As Long
End Function
<dllimport("kernel32.dll")> Public Shared Function GetCurrentProcess() As Long
End Function
<dllimport("advapi32.dll")> Public Shared Function OpenProcessToken(ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, ByVal TokenHandle As Long) As Long
End Function
Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, ByVal lpLuid As LUID) As Long
<dllimport("advapi32.dll")> Public Shared Function AdjustTokenPrivileges(ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, ByVal NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, ByVal PreviousState As TOKEN_PRIVILEGES, ByVal ReturnLength As Long) As Long
End Function
<dllimport("kernel32.dll")> Public Shared Sub SetLastError(ByVal dwErrCode As Long)
End Sub
Private Const mlngWindows95 = 0
Private Const mlngWindowsNT = 1
Private glngWhichWindows32 As Long
Public Structure LUID
Public UsedPart As Long
Public IgnoredForNowHigh32BitPart As Long
End Structure
Public Structure LUID_AND_ATTRIBUTES
Public TheLuid As LUID
Public Attributes As Long
End Structure
Public Structure TOKEN_PRIVILEGES
Public PrivilegeCount As Long
Public TheLuid As LUID
Public Attributes As Long
End Structure
Public Enum sdAction
Reboot = 1
Shutdown = 2
Logoff = 3
End Enum
Private Sub AdjustToken()
Const TOKEN_ADJUST_PRIVILEGES = &H20
Const TOKEN_QUERY = &H8
Const SE_PRIVILEGE_ENABLED = &H2
Dim hdlProcessHandle As Long
Dim hdlTokenHandle As Long
Dim tmpLuid As New APITest2.TestAPI.LUID()
Dim tkp As New TOKEN_PRIVILEGES()
Dim tkpNewButIgnored As New TOKEN_PRIVILEGES()
Dim lBufferNeeded As Long
SetLastError(0)
hdlProcessHandle = GetCurrentProcess()
OpenProcessToken(hdlProcessHandle, (TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY), hdlTokenHandle)
LookupPrivilegeValue("", "SeShutdownPrivilege", tmpLuid)
tkp.PrivilegeCount = 1 ' One privilege to set
tkp.TheLuid = tmpLuid
tkp.Attributes = SE_PRIVILEGE_ENABLED
AdjustTokenPrivileges(hdlTokenHandle, False, tkp, Len(tkpNewButIgnored), tkpNewButIgnored, lBufferNeeded)
End Sub
Public Sub ExitWin(ByVal Act As sdAction, ByVal Force As Boolean)
Dim iAction As Integer
AdjustToken()
If Act = sdAction.Logoff Then iAction = EWX_LogOff
If Act = sdAction.Reboot Then iAction = EWX_REBOOT
If Act = sdAction.Shutdown Then iAction = EWX_SHUTDOWN
If Force = True Then
ExitWindowsEx((iAction Or EWX_FORCE), CLng(&HFFFF))
Else
ExitWindowsEx(iAction, CLng(&HFFFF))
End If
End Sub
Public Sub New()
Dim lngVersion As Long
lngVersion = GetVersion()
If ((lngVersion And &H80000000) <> 0) Then
glngWhichWindows32 = mlngWindowsNT
Else
glngWhichWindows32 = mlngWindows95
End If
End Sub
End Class
Using the ExitWin Sub to call the shutdown procedeure. Any Ideas
|
|
|
|
|
Change your definition of LookupPrivilegeValue to this:
Public Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As LARGE_INTEGER) As Long
and LARGE_INTEGER is declared liek this:
Public Type LARGE_INTEGER
lowpart As Long
highpart As Long
End Type
Use the APIViewer tool in VB to create these function declarations for you.
Good luck.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
How can I access the DHTML objects from an activex created from new ActiveXObject("") jscript method?
Or I can just do this if I create an activex control?
thanks,
Luiz
|
|
|
|
|
You have a reference the ActiveX control first in Project/References.
JScript Example:
var objSession = new ActiveXObject("MAPI.Session"); VB Example:
Dim objSession As MAPI.Session
Set objSession = New MAPI.Session
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
<nobr>
Homepage : Sonork = 100.16311 01000010011011110110001000100000011101110110000101110011 00100000011010000110010101110010011001010010111000000000
|
|
|
|
|
I made an VBA Add-In template in MS Word 2000. Is there any way i could make it work in MS Word 97, too? Ive tried to use it in Word 97 but it gave me an error message saying it wont compile... Can anyone help?
|
|
|
|
|
How could I put a array of bytes into a file ???
|
|
|
|
|
Dim b() as Byte
'Do something with b
Open "filename.txt" For Binary As #1
Put #1, , b
Close #1
Should work...
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
I don't know if you mean this, sorry if don't
Open "outputfile" for output as #1
For intI = 1 to ubound(arrArrayName)
print #1, arrArrayName(intI)
Next intI
Close 1
See:
Syntax
Open pathname For mode [Access access] [lock] As [#]filenumber [Len=reclength]
The Open statement syntax has these parts:
Part Description
pathname Required. String expression that specifies a file name — may include directory or folder, and drive.
mode Required. Keyword specifying the file mode: Append, Binary, Input, Output, or Random. If unspecified, the file is opened for Random access.
access Optional. Keyword specifying the operations permitted on the open file: Read, Write, or Read Write.
lock Optional. Keyword specifying the operations restricted on the open file by other processes: Shared, Lock Read, Lock Write, and Lock Read Write.
filenumber Required. A valid file number in the range 1 to 511, inclusive. Use the FreeFile function to obtain the next available file number.
reclength Optional. Number less than or equal to 32,767 (bytes). For files opened for random access, this value is the record length. For sequential files, this value is the number of characters buffered.
Fernando Finelli
|
|
|
|
|
I am not very familar with Microsoft Access,but it seems that when you encrypt a access file(in menu tool->security),you needn't enter a username.Now the problem come:
In VB6.0,how can i connect to such a encrypted file?By data control,i didn't find any property related to database security;by ADO,the connection string shall contain a username,but what's the username to such a file?I tried leave it empty,but it caused a error
|
|
|
|
|
Hi all,
I've got problem when I try using Visual Basic 6.0 to display Unicode font on menu bar. Some characters appear with the question-marks.
If you'd done well this issue, please show me. I'm looking forward to your replies. Thanks a lot for your help.
Vu Truong.
|
|
|
|
|
This is a little difficult, you will need to resort to the Windows API's in order to do this.
You will need to look into localization functions to properly set the locale of the strings that your are working with. I do not have any more information than that right now, but I will try to post a link later today.
I hope this gets you started.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
This is to all the excel geniuses, am trying to limit the lenght of text in a dailog box(in excel) if you think u can help plz reply
Thanks
|
|
|
|
|
I assume you are using a textbox. Just set the MaxLength property to the length you need. You can do this in the properties window (right click the text box and select Properties) or in code (Userform1.Textbox1.MaxLength = xx in the initialize procedure).
|
|
|
|
|
How do you create a new User Defined function for Crystal.Net?
|
|
|
|
|
|
I want put array of 400 byte into a field in Access Table from my code (VB).
How ???
|
|
|
|