win32-process

How to schedule a task using win32_schedule job class

喜夏-厌秋 提交于 2019-12-25 18:32:30
问题 I've to create a class which schedules a task to run at specified time. I know it can be achieved by win32_schedule class create method. Can someone please help me in creating a task which opens at a specified date and time?(Code Sample). Help me with the start time parameter(conversions and all) 回答1: It's not a code sample, but it can help you: http://social.msdn.microsoft.com/Forums/vstudio/en-US/022e4429-56bc-482c-9a67-af484d6978c1/using-windows-scheduled-tasks-in-c?forum=csharpgeneral 来源:

How to Initialise a Handle

江枫思渺然 提交于 2019-12-24 03:48:15
问题 Error: Run-Time Check Failure #3 - The variable 'TextLabelVar' is being used without being initialized. Illustrative Code: HWND VarText; char Disps[100]; float some_number; WINAPI WndProc(..) { switch(...) case WM_CREATE: TextLabelVar=CreateWindowEx(WS_EX_WINDOWEDGE,TEXT("Edit"), TEXT("Val."), WS_CHILD \ | WS_VISIBLE, 380, 50, 140, 20, hwnd, NULL, NULL, NULL); break; case WM_MESSAGEFROMANOTHERWINDOW: some_number=1298.123123; sprintf(Disps,"%f",some_number); SetWindowText(TextLabelVar,TEXT

WMI Win32_Process.Create fails with Insufficient Privs

喜欢而已 提交于 2019-12-23 02:53:33
问题 I'm trying to run a simple cmd utility on a remote Windows server from within a vbscript by invoking the Win32_Process class, like so: serverIP = "10.0.0.3" Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & serverIP & "\root\cimv2:Win32_Process") RunCommand = "cmd.exe /c echo hello >c:\hello.txt" wscript.echo RunCommand intReturn = oWMI.Create(RunCommand, Null, Null, intProcessID) wscript.echo intReturn Select Case intReturn Case 0 Wscript.Echo "Successful" Case 2 Wscript

Hosting WPF plugin cross-process issue

天大地大妈咪最大 提交于 2019-12-23 02:43:07
问题 I use an approach similar to http://www.codeproject.com/Articles/516431/Baktun-Shell-Hosting-WPF-Child-Windows-in-Another to host WPF applications (plugins) in another process via the AddInHost (derived from HwndHost) class. This works fine so far as long as I don't suspend the child process. If I do so then also the parent process is frozen. The reason for this is that the parent/child processes are sharing the same (synchronous) Input Queue: Good or evil - SetParent() win32 API between

WaitForSingleObject doesn't wait the end of the process [duplicate]

五迷三道 提交于 2019-12-20 07:47:09
问题 This question already has answers here : Why those two different behaviors with WaitForSingleObject function in CPP (2 answers) Closed last year . I would like to wait the end of the process execution (calc.exe) but it doesn't work. My program finishes fast/now while my process(calc.exe) continue to run (I don't stopped it). and WaitForSingleObject returns immediatly WAIT_OBJECT_0. ps: I disabled my software anti-virus (AVIRA) int main(int argc, char** arv) { STARTUPINFO si; PROCESS

Get the Cpu usage of each process from wmi

冷暖自知 提交于 2019-12-19 02:28:25
问题 I found many sources to get the cpu usage of each process. in general there are many ways to get the cpu usage of process . percentprocessortime from win32_perfformatteddata_perfproc_process performancecounter class in system.diagnostics by manual calculation Process class (by process.getcurrentprocess().totalprocessortime;) as said in here. FirstWay: For the remote process monitoring(my scenario is remote monitoring), the percentprocessortime always shows value 0 to 100+. this 100+ happens

GetPrivateProfileInt- reading only the default values

别等时光非礼了梦想. 提交于 2019-12-14 03:45:40
问题 I am trying to read a .init config file in c++ having the content. [Ipaddress] Ipaddress=169.254.115.22 [ScanConfiguration] Scanfrequency=2500 ScanResolution=2500 StartAngle=700000 StopAngle=1100000 Till Now, I have used this code for reading the data. My project is of Unicode character set and hence used L before the string values. int iScanFreq =GetPrivateProfileInt(L"ScanConfiguration",L"Scanfrequency", 2500, L"filename.ini"); int iScanRes =GetPrivateProfileInt(L"ScanConfiguration",L

What is the command line at GetCommandLine and at WinMain API?

China☆狼群 提交于 2019-12-13 02:13:21
问题 For a Win32 application, what is the command line that I call GetCommandLine to get and send it as parameter for WinMain? 回答1: Ignoring issues of encoding and information loss, and glossing over what's a macro and what's a function, GetCommandLine is an API function that retrieves the original command line passed to the process, while WinMain is a function defined by your code that is called by Microsoft's C and C++ runtime support, and that is passed a copy of the part of the command line

How to get Notepad file saved location

非 Y 不嫁゛ 提交于 2019-12-13 01:37:10
问题 How to retrieve the actual path of the notepad file if it is saved in drive. For example a notepad process is running and it is saved somewhere in the drive. How can I retrieve its full path? Using below code I can get the process detail, but not the actual path of particular files. Process[] localByName = Process.GetProcessesByName("notepad"); foreach (Process p in localByName) { string path = p.MainModule.FileName.ToString(); } this returns executeable path but i need Drive location whre

Lightweight method to use Amd64 instructions under 32-bit Windows?

人走茶凉 提交于 2019-12-12 10:43:12
问题 For some CPU-bound code using 64-bit variables, it is beneficial to use the Amd64 instruction set rather than x86. How can it be done under 32-bit Windows (e.g. Windows XP SP3)? Of course I assume a modern, Amd64-enabled CPU. I'm excluding the working but heavyweight method: running a full-blown 64-bit OS as a virtual machine, e.g. Ubuntu for Amd64 under Virtualbox. I understand some assembly is needed, and there will restrictions, in particular addressing more memory than 32-bit Windows