|
You can get the TotalProcessorTime and UserProcessorTime using the Process class. Docs for which can be found here[^].
RageInTheMachine9532
|
|
|
|
|
Sir i want to creat a Vc++ system wide hook dll.{{Whatever hook articles available on the internet are intended for advanced developers who know thing or 2 in vc++.}}But students like me who are new to vc++ find it difficult to grasp some ideas.
I want a basic level explanation from some experts who really wants to teach those things to their students.
The hooks i am intended to create is Wh_Getmessage and i have to call that dll from vb6
Say my objective of this hook is say if i a user type A then i have to change to B for any application running.
I am a stranger to vc++ so i need help in how to create this {{system wide}} wh_getmessge hook
1.In vc++ in new what dll i have to chose ]
a.MFC appwizard Dll
b.WIn32 Dynamic link library
What is the difference between these 2 dlls.?
2.What is an header file and what are the things we have to declare here and why we have to declare??
3.How functions in vc++ dll should be declared inorder to call those functions from vb.?
4.Say i am calling SetHook funciton from vb which is in dll then hook is set.
MsgFilterHook = SetWindowsHookEx( WH_GETMESSAGE,(HOOKPROC)MsgFilterFunc, dll_hInstance, threadID );
I am having the hookhandle in MsgFilterHook which i can use to unhook this hook.
Threadid = 0 to create a system wide hook
MsgFilterFunc is my callback function
My doubt is once hook is set , will the system automatically call my callback filter function for any application which process getmessage
Say i have notepad and i am typing A and in my call back function i will get a wm_char = A.NOw if i change to another application say wordpad and type B
then will it be possible to get the wm_char=B message in my callback function.Please Explain me how does this work.
5.Say n no of editor applications are running and i want to disable the character T from going to any application and i have to make T into H how to do this in my callbackfunciton.Issue in this question is how am going to get these hook work for any application which is running.??
Issues
1.How to start creating a dll in vc++6
2.Header file decleration ideas.
3.Export functions declerations.
4.Explanations of how these hook work on a systemwide basis(i understood how dll maps the memory of other applications but wanted codings point of view like what are the parameters come to callback function each time a new application is actvated.)
5.What is #pragma and shared data segment ?How variables should be decalred in the hook dll and how it should be accessed??Please explain at a lower level how this things are implemented why is the need?
Thanks in advance.
|
|
|
|
|
Is there a way that i can monitor the use of a file in terms of a timestamp? My goal is to monitor the activity of a file and when it goes beyond 10 minutes of non activity I will shut it down.
|
|
|
|
|
Not reliably. You don't have to actually run the executable to change its 'Last Accessed' attribute. Just getting properties on the file will change it.
A better method would be to poll and watch the process list, look for the name you want and get its process ID when it shows up, then monitor that ID for CPU usage. You could get those statistics from the Process class.
RageInTheMachine9532
|
|
|
|
|
I'm a .NET programmer who knows how easy it is to access special folders via the Application.CommonAppDataPath and System.Environment.GetFolderPath() members, but how does one do this in VB 6?
|
|
|
|
|
GetSystemDirectory API to get system directory
GetWindowsDirectory API to get windows directory
GetTempPath API to get temp directory
SHGetSpecialFolderLocation ,SHGetFolderLocation are also useful
look msdn for details
|
|
|
|
|
I am a C++ prgrammer but have very little VB experience.
Could someone help me with the following:
I have Win32 dll, and need to call a function from VB:-
code:--------------------------------------------------------------------------------
int WINAPI SCN_Open_Device(HWND, LPDWORD, LPSTR, LPSTR, LPSTR, LPSTR, LPWORD);
--------------------------------------------------------------------------------
I have declared the function as
code:--------------------------------------------------------------------------------
Declare Function SCN_Open_Device Lib "D:\My Projects\Development\Phillipines\VB1\scn_scsi.dll" (ByVal hwnd As Long, ByVal num_device As Long, ByVal vendor_model As String, ByVal product_version As String, ByVal periph_name As String, ByVal path_ini_file As String, ByVal dll_version As Integer) As Integer
--------------------------------------------------------------------------------
And called the function from Vb as follows:
code:--------------------------------------------------------------------------------
Dim Par1 As Long
Dim Par2 As String
Dim Par3 As String
Dim Par4 As String
Dim Par5 As String
Dim Par6 As Integer
Dim Result As Integer
Result = SCN_Open_Device(Form1.hwnd, Par1, Par2, Par3, Par4, Par5, Par6)
--------------------------------------------------------------------------------
But I get a crash.
Could someone tell me what I am doing wrong?
I guess my data types are incorrect ???
Eternally grateful to anyone who helps me
Rich
|
|
|
|
|
This might help, but the final five parameters are to be pointers and the only way to have VB pass a pointer would be in the function definition to use the clause 'ByRef' instead of using 'ByVal'. Having said that though, I suspect that 'String' types in VB are not the same as the 'string' types in C++. AFAIR I had to declare my C routine in the DLL as "pointer to a pointer to a type" in order to get things to work properly. Also I'm not sure whether the WINAPI is a std_call or not. The calling convention is pretty important to get correct for all these things to work.
Chris Meech
It's much easier to get rich telling people what they want to hear. Chistopher Duncan
I can't help getting older, but I refuse to grow up. Roger Wright
I've been meaning to change my sig. Thanks! Alvaro Mendez
|
|
|
|
|
I'm working on a class (.dll) that i'm willing to publish on the internet.I'm desiging the class in VB.Net and the thing is that i want the users who implement my class in their projects to see characteristics of the methods they're using when they point at them in the object browser window ( you know when u wanna use a method or a function u must understant its behavior).
I know that i can attach with my class a document file that explains the summary of the methods that class offers but i wanted it to be more prfessionnal.
So is there any way i can do this?
Joe Zeitouny
zeitounybros@hotmail.com
|
|
|
|
|
You can add your descriptions using attributes directly in your code. But, you still might want to include a documentation file of some kind to be complete.
Search in the help for Visual Basic.NET for 'Attributes and Design-Time Support' for how to add descriptions and whatnot to your code.
RageInTheMachine9532
|
|
|
|
|
Does anyone have vb.net code to kill a window using win32 api?
|
|
|
|
|
What do your mean by 'kill a window'?
If your looking to kill a 'window', you can't.
If you mean kill the process that owns the window, then you might want to look here[^] for considerations and methods to accomplish this.
RageInTheMachine9532
|
|
|
|
|
Yes, I suppose it is the process. The link you sent was good but I need if for vb.net
|
|
|
|
|
I haven't been able to come up with a VB.NET sample of the same thing, but there is no reason why the sample cade can't be converted into VB.NET using calls into the Win32 API.
RageInTheMachine9532
|
|
|
|
|
SELECT Sum(Amount) as "Total Expenditures", Month(eDate) as "Month"
FROM Expenditure
GROUP BY Month(eDate)
ORDER BY Month(eDate)
Above is my current SQL statement. I would like to change it so that it would generate a table that shows zeros for months that have zero "Total Expenditures". Currently it only shows amounts for months that have
total > 0. I think I could do it once I get it into my datatable but the query would be nicer.
Thanks
"It has become appallingly obvious that our technology has exceeded our humanity."
- Albert Einstein (1879-1955)
"I think there is a world market for maybe five computers."
- Thomas Watson (1874-1956), Chairman of IBM, 1943
"640K ought to be enough for anybody."
- Bill Gates (1955-), in 1981
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
How about a WHERE clause like 'WHERE Sum(things) = 0' at the end.
The warlord
|
|
|
|
|
That would only retrieve months with zero expenditures. I want both months with zeros and months with amounts > 0 in one table.
|
|
|
|
|
I am trying to use the GetFileOpen command and I have it working fine. I just want it to default to open to the same folder. c:/Assembly/ here is the code I have.
fileToOpen = Application _<br />
.GetOpenFilename("Assembly (*.exe), *.exe", , "Open Clave Drawings") How do I get it to always open the C:\Assembly folder?
Thanks,
Steve
|
|
|
|
|
I'm assuming this is code for an Office application...
The short version is you can't set that in the control directly. But, you might want to try launching the file that contains your worksheet or database from that folder first to see if that takes care of it.
The long version is you could write your own Open File dialog to get the exact functionality you want.
RageInTheMachine9532
|
|
|
|
|
I want to migrate a Application from ASP and VB6 to .NET
The main Part of the appication resides in a DLL written in VB accessing Request, Response and Session Object of the ASP-Page. It returns also a string back to the calling ASP-Page.
In a first step, I want to call the VB6.DLL from a .aspx Page.
Can I pass the scripting context in a similar way I did with asp?
Is it possible to write something like:
...
Dim IgPage As New IG4ASPA11.ASPPage
IGOutput = IgPage.OnStartPage(xxxxx)
IGOutput = IgPage.OnePage
....
What would I have to write instead of xxxxx?
Your help is very much appreciated
Beat
I add some relevant code from the old VB6 / ASP-Application
VB6-Code START -----------------
Class Module ASPPage
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
' is autmatically called
Set MyScriptingContext = PassedScriptingContext
...
End Sub
Sub OnePage()
' complex application accessing Session, Request, Response and Applicaiton Object
....
MyScriptingContext.Response.Write "Some Direct Response Text"
...
OnePage = MyOutput
End Sub
VB6-Code END -----------------
ASP-Code START------------------
Code from the calling ASP-Page
Set ig4asp = Server.CreateObject("IG4asp.ASPpage")
zResp = ig4asp.onepage
Response.write zResp
ASP-Code END------------------
Beat
|
|
|
|
|
Hello everybody!
I'm a beginner developer in .Net and I need to know if I can convert Bitmaps to Metafiles in anyway. ( The Save method of the Image Class does´nt work beetwen vectorial images and pixelized images ).
Advanced Thanks!
|
|
|
|
|
There is no indiginous class to the .NET Framework that will convert between vector and bitmap images. Your going to have to either search for a 3rd party control (I haven't been able to find one) or write one yourself. The main problems are going to be getting scaling right since vector images can be scaled to any size without loss of quality and bitmap images can't.
RageInTheMachine9532
|
|
|
|
|
Thanks for reply, I'm going to try it.
|
|
|
|
|
hello all, this is my first mesage here!
Well i'm have a litle problem... i'm trying to catch a key whit the
Overrides Sub OnKeyPress and the code that I'm write was this:
<br />
If e.KeyChar = Microsoft.VisualBasic.ChrW(?) Then<br />
<br />
abol_x = bol_x<br />
bol_x += 10<br />
mov_bola()<br />
e.Handled = True<br />
End If<br />
the first problem that i'm have is to now the char code to the cursors keys.. is a map whit that anywere?
the idea is to move a ball whit this and that is done whit the sub mov_bola, and only if i'm press the up cursor key i'm whant to execute this code
Others things the ball is disign in runtime using GDI+ and designed in a picturebox
any sugestion to help me on this is apreciated
Thanks
The Limit is your mind
|
|
|
|
|
Hi. I’ve never coded in VB but I want to do one small plug-in for MSProject. I want a tool button that (when pressing it) saves the current project in a file c:\temp.xml file (The XML format is important).
Is VB the “right way” to solve my problem? Open for suggestions.....
Thanks
APe
|
|
|
|