Hi every one I am New using VB and also new in this Web site I created and VB Application the Read, add, and delete Printers records from an Access database. But the Application don't know when the Printer is Online or Offline I have to manually update that. I want that the be automatically and this is what I have so far but is not saving it...Please help me
PrivateSub SplashForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
PFCdbconnection = New OleDbConnection("Provider=microsoft.jet.oledb.4.0; data source =F:\Device Files\MFC\Common\Shared\Printer Control\PFC.mdb;jet OLEDB:Database Password=password;")
printerscommand(0) = New OleDbCommand("SELECT Printer,IPAddress,OffLine,Online FROM PrinterInfo ORDER by ID", PFCdbconnection)
printersAdapter(0) = New OleDbDataAdapter()
printersAdapter(0).SelectCommand = printerscommand(0)
PrintersTable(0) = New DataTable
PrintersManager(0) = DirectCast(Me.BindingContext(PrintersTable(0)), CurrencyManager)
Dim MaxRow AsInteger
MaxRow = PrintersTable(0).Rows.Count
Dim RPosition AsInteger = 0Do Until RPosition = MaxRow
PrintersTable(0).DefaultView.Sort = "Printer"
PrintersManager(0).Position = RPosition
PrinterIPTextBox.DataBindings.Add("Text", PrintersTable(0), "printer")
If My.Computer.Network.Ping(PrinterIPTextBox.Text) Then
OnlineRadioButton.Checked = TrueElse
OfflineRadioButton.Checked = TrueEndIf
Dim CurrentInfoData As DataRow = PrintersTable(0).Rows(PrintersTable(0).Rows.Count - 1)
If RPosition = -1 Then
CurrentInfoData.Item("Online") = OnlineRadioButton.Checked
CurrentInfoData.Item("offline") = OfflineRadioButton.Checked
Dim PrinterInfoCom AsNew OleDbCommandBuilder(printersAdapter(0))
RPosition = RPosition + 1LoopEndSub
I'm trying to write a small application that will show the GPU temperature.
I'v found the following documentation about the subject:
according to this documentation, I can use the nvcpl.dll file (which is a part of the NVIDIA driver) like this:
BOOL CDECL NvCplGetThermalSettings
(IN UINT nWindowsMonitorNumber,
OUT DWORD* pdwCoreTemp,
OUT DWORD* pdwAmbientTemp,
OUT DWORD* pdwUpperLimit);
Parameters In UINT nWindowsMonitorNumber -- The display number shown on
the Windows Display Properties->Settings page.
A value of 0 indicates the current primary Windows display device.
DWORD* must be a valid pointer --
pdwCoreTemp -- GPU temperature in degrees Celsius.
pdwAmbientTemp -- Ambient temperature in degrees Celsius.
pdwUpperLimit -- Upper limit of the GPU temperature specification.
Return Values True on success.
False on failure.
Now the problem is that this code keeps sending back 0, which means somethin is wrong here and the function is not working. It's been two days now and i still can't figure it out :S
I'd really appreciate any help.. thanks alot!
Instead of using Long for data types, use Integer. Long is a 64-bit integer whereas the C function header is specifying an unsigned int (unsigned 32-bit integer). In this case, it really doesn't matter if you use UInt32 or Integer.
don't worry too much about signed/unsigned integers, the one thing that matters is their size, and you got that right.
My best guess is: you are calling the function all right, and it fails, i.e. it returns false, probably (some googling suggests so) because you are running on Vista or higher, and giving you a temperature value is considered a risky thing to do.
I have windows 7 64bit.
with C/C++ it can be done and i'v seen it working, but i want to achieve this with VB.NET, that's the goal. google didn't help believe me i'v read evey possible related thread to this subject, and still found no answer.
actually i just checked again, it was a PureBasic code :S i didn't know this existed till now. I downloaded the code and checked it on my system (windows 7) and it gave perfect results.
The program uses different files, it use nvapi.lib and there is a different documentation for this library on how to access it and use it, but i dunno how i can use it with VB.NET. I don't think it's possible.
If that app uses a LIB file, there must be a DLL file as well. My Vista/32 system has an nvapi.dll file in its Windows\system32 folder. My Win7/64 system doesn't, as it doesn't have NVidia hardware.
If you have a DLL that holds the functionality implemented in native code, and the system authorizes you to do whatever it is the function does, then you can call it, from the language of your choice. For managed languages such as C# and VB.NET, that would mean one or more P/Invoke calls, DllImport attributes, and the lot. It is quite doable, your link should provide the necessary inspiration.
One issue that is likely to surface is 32-bit vs 64-bit. I suggest you try and build your managed code app as a 32-bit app (i.e. targetting "x86", not "x64" or "AnyCPU"). First check if and where nvapi.dll is present, it should be in either windows\system32 (which holds 32-bit code on Win32, and 64-bit code on Win64!!!) or windows\sysWOW64 (which holds 32-bit code only). Note: you cannot combine 32-bit and 64-bit code in a single process.
Im sitting here with a tricky VBScript question, specifically a need to set a IIS7 App Pool recycle schedule via VMI.
Currently this is in place - letting me set a specific time interval for an IIS7 App Pool, but this is not our strategy going forward, so i must enable a specific time of day where we recycle the Pool.
'*** Set Application Pool Recycling settings
Set objRecycling = objWMIService.Get("RecyclingSettings").SpawnInstance_
'objRecycling.DisallowOverlappingRotation = Null
'objRecycling.DisallowRotationOnConfigChange = Null
'objRecycling.LogEventOnRecycle = Null
objRecycling.PeriodicRestart = objPeriodicRestart
This works perfectly for a time interval, but as you can see the "Schedule" is outcommented. I've tried to set the schedule with the IIS6 approach which accepts an array of strings defining the times of day to recycle. But with NO luck.
Can any of you define what code is needed (objects, classes) to define a schedule that the IIS7 WMI accepts.
i want to use inet control to create directory in the directory at the remote server, and i have written the following codes which are running and no error msg, but no folder is created! anyone can help this?
No it's not easier it's different and no longer supported by MS and a lot of troubles when you want to used it in windows Vista or 7. 8 it almost there. Even more installing on these OS will have troubles also
Don't get me wrong. I have used it and I still used it for old programs that I didn’t get time to convert. It was very good in the prehistory; but now obsolete.