|
Hi All,,
I am using MFC Application with VS 2005.
In my application I am capturing the current screen by creating virtual window(by CreateWindow()) and apply hooks to that Window. In hooks I take the perticuler region which is going to be updated and convert it into the rectangle and send these messages to the my application. In My MFC class I store these all rectangles into the list.
And I retrived these list and capture from screen (using bitmap)with that perticular rectangle and compress that rectangle using JPEG.
Here I used Hooks as DLL in other project in my current workspace, so it gives me continues messages with that rectangles.
So , How can I set thread ( or Critical section or mutex) in my application and plz suggest me where i have to create Thread or on which method or class.
I am very sorry for very large description but it is good to understand.
Thanks in Advance.
Ashish Bhatt
|
|
|
|
|
Do you really have to use a thread? (Multitasking should be avoided at all costs, in my opinion)
|
|
|
|
|
ashishbhatt wrote: but it is good to understand.
Yes it is. Therefore it would be good for you to understand threads and threading issues before you develop a multi-threading application yes?
There are sources on the internet you can use, try google, I also recommend the book Advanced Windows by Richter.
|
|
|
|
|
Hi All,
I am writing a Win32 application to retrieve the information of all drivers on the user’s system. To do the same, following steps are used:-
1. SC_HANDLE hSCManager = OpenSCManager()
2. use the hSCManager to enumerate drivers using EnumServicesStatusExW( ) as follows
ENUM_SERVICE_STATUS_PROCESSW* pBuf ;
EnumServicesStatusExW( hSCManager, SC_ENUM_PROCESS_INFO, SERVICE_DRIVER, SERVICE_STATE_ALL, pBuf , dwBytesNeeded, &dwBytesNeeded, &dwTotalDrivers, &dwResumeHandle, NULL ) ;
3. I get service name using pServiceStatusProcess[i].lpServiceName
Now I need to retrieve further information of the driver for which I follow following steps
4. SC_HANDLE hService = OpenServiceW( hSCManager, wstrDriverName.c_str(), SC_MANAGER_ALL_ACCESS )
5. QueryServiceConfigW( hService, lpQueryServiceConfig, dwNeeded, &dwNeeded )
I get fully qualified path name of driver file name using lpQueryServiceConfig->lpBinaryPathName
My problem is, I am not able to get path name for all drivers. Dont know why? I am getting blank file name for following drivers
Abiosdsk, abp480n5, ACPIEC, adpu160m, Aha154x, aic78u2, aic78xx, AliIde, amsint, asc, asc3350p, asc3550, Atdisk, Beep, cbidf2k, cd20xrnt, Cdaudio, Cdfs, Changer, CmdIde
I need fully qualified filename of the driver to retrieve information like creation time, version information of the respective driver files.
Please let me know if there is any way to get the desired information.
Thanks in advance
Manish c
|
|
|
|
|
manish_c wrote: My problem is, I am not able to get path name for all drivers. Dont know why? I am getting blank file name for following drivers
Abiosdsk, abp480n5, ACPIEC, adpu160m, Aha154x, aic78u2, aic78xx, AliIde, amsint, asc, asc3350p, asc3550, Atdisk, Beep, cbidf2k, cd20xrnt, Cdaudio, Cdfs, Changer, CmdIde
Peeking into the registry reveals that those particular entries do not contain a path name. If it isn't there, the SCM can't give you one. It is working correctly and telling you that there isn't a binary name.
Judy
|
|
|
|
|
My problem is this:
I use SetSel() and SendMessage(EM_SETCHARFORMAT, ...) to highlight stuff in the control, and it works fine when using SetWindowText() to set the contents of the control. However, when I use streaming for setting the contents, and if the selection to highlight starts at the first character position (CHARRANGE.cpMin = 0), the highlighting is applied to the entire contents of the control. Moreover, the formatting remains when I fill the control with new text, even if I don't highlight anything in the new text.
Reproducable with:
<br />
int nTransfer;<br />
<br />
nTransfer = _tcslen(m_pchStreamBuf);<br />
if(nTransfer > cb)<br />
nTransfer = cb;<br />
memmove(pbBuff, m_pchStreamBuf, nTransfer);<br />
*pcb = nTransfer;<br />
m_pchStreamBuf += nTransfer;<br />
return 0;<br />
<br />
CHARFORMAT2 cf;<br />
memset(&cf, 0, sizeof(cf));<br />
cf.cbSize = sizeof(cf);<br />
cf.dwMask = CFM_COLOR | CFM_BACKCOLOR;<br />
cf.crTextColor = RGB(0x00, 0, 0);<br />
cf.crBackColor = RGB(0x00, 0xff, 0xff);<br />
m_ctrl.SetSel(0, 3);<br />
m_ctrl.SendMessage(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);<br />
Anyone?
|
|
|
|
|
Hi All,
I am writing a Win32 application to retrieve the information of all process running on the user’s system. To do the same following steps are used:-
Create the process handle Using Win32 API OpenProcess(,,), on passing process id as a parameter
Handle returned by OpenProcess(,,) is further used to retrieve the other information of the process like process name, associated modules etc.
OpenProcess API fails to create the handle for process id 0(system idle process) and 4 (system). API always returns NULL for process id 0 and 4 and hence I am not able to retrieve the associated information.
dwPID = 0 ;//or 4
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, dwPID ) ;
if ( NULL != hProcess )
{
if ( EnumProcessModules(hProcess, &hModule, sizeof(hModule), &dwTotalModulesSize) )
}
else
{
cout<< “Unable to open handle “<<endl ;
}
Please let me know if there any way to get desired information for pid 0 and 4.
Thanks in advance
Manish c
|
|
|
|
|
manish_c wrote: Create the process handle Using Win32 API OpenProcess(,,), on passing process id as a parameter
Handle returned by OpenProcess(,,) is further used to retrieve the other information of the process like process name, associated modules etc
actually they are system process, they keep track of system idle time, so mightbe that will reason you mightn't be getting the handle to the process!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
manish_c wrote: OpenProcess API fails...
So why aren't you calling GetLastError() to find out why?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi all vc++ masters
please tell me how to access c: drive of other system in network from my system
please i need this and please help me
thanks all for their valuable help
thanks
|
|
|
|
|
p_ wrote: please tell me how to access c: drive of other system in network from my system
\\SYSTEM_NAME\\c$ is of any help!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok wrote: \\SYSTEM_NAME\\c$
If that works, someone needs to be hit on the head. With a club. Hard and fast. Multiple times. And again. And again. If you or he starts to like it, keep on. He deserves it.
This old security-hole should have been closed for years now...
-- modified at 11:03 Thursday 25th October, 2007
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
What on earth are you waffling on about? The only security hole is access rights on the remote machine, which by default are extremely limited.
Waldermort
|
|
|
|
|
If you think that accessing your CEOs (or any coworker for that matter) C: (D:, E:, F:...-Drive is not a security-hole, I think no one can help you.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
jhwurmbach wrote: If that works, someone needs to be hit on the head. With a club. Hard and fast. Multiple times. And again. And again. If you or he starts to like it, keep on. He deserves it.
have you ever work on network!? \\SYSTEM_NAME\\c$ is still available except now you have to provide username and password.
|
|
|
|
|
Oh - thats new, then. The hole is closed here for years, now.
In XP you still could access anything not hidden well enough.
E.G. Your bosses USB-Stick (FAT-Formated as it is).
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
jhwurmbach wrote: Oh - thats new, then. The hole is closed here for years, now.
i don't understand ... what you want to say!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
OK, again slowly:
Until recently, even in XP (I think), you could scan all mounted drives on all computers in the local windows-network (that is anything up until the next network router).
Anything between you and full access was the Windows file security. Non-existant e.g. on USB-Sticks.
That IS a security hole. Regardless what Microsoft-cultists say.
This could have been switched off in the registry. See here[^].
Our network policy enforces this.
Now you tell me, that this no longer the case. Fine.
It should have been never. And the ones responsible for that need to be disgraced until their fourth decendant.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
As an owner of a small local area network with only 3 PC's in it all on my desktop I am glad this feature exists it makes it so much easier.
|
|
|
|
|
Easier than just creating a real share where you need it?
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
well actually no, because I know how to use Net Share from the commandline, but yes if all I had was the poxy windows folder share prpoerty sheet it is much easier because the property sheet sharing page wants to reset all permissions on every thing below the share point which is totally unneccessary in a desktop lan environment.
|
|
|
|
|
Hello,
I have a tab control, contents of which are displayed by a CDialog. This dialog contains different controls on it. I am having following issues :-
1) After I run my app, if I put another window on top of it (say calc.exe) and switch back to my app, I see the area convered by calc.exe is erased!
2) I have a menu which pops up if I do a right control on the header of my Clistctrl .. after the menu goes away, the area covered by the menu is erased and comes back only when I move my mouse over the area...
3) If I hit enter the contents on the tab control (which are displayed by CDialog) go away completely!
Thank you in advance for your help...
|
|
|
|
|
neil4781 wrote: 1) After I run my app, if I put another window on top of it (say calc.exe) and switch back to my app, I see the area convered by calc.exe is erased!
2) I have a menu which pops up if I do a right control on the header of my Clistctrl .. after the menu goes away, the area covered by the menu is erased and comes back only when I move my mouse over the area...
I guess it is because of z-order problem. What is the parent child relation of tab and the dialog having the controls?
neil4781 wrote: 3) If I hit enter the contents on the tab control (which are displayed by CDialog) go away completely!
Override OnOK() and OnCancel() in the dialog having the controls. Like OnOK() { } and OnCancel() { } in the class declaration. Rebuild the project to avoid compilation issues.
- NS -
|
|
|
|
|
Thanks NS...
>> I guess it is because of z-order problem. What is the parent child relation of tab and the dialog having the controls?
How do I find that out?
Also, another problem I forgot to mention was .. if I hold on move my app window, the controls start disappearing ...
|
|
|
|
|
See, if a button is placed in a dialog, then the dialog becomes the parent of the button and the button is a child of the dialog.
Similarly, if the tab and the controls' dialog are the childs of the same parent, then there can be painting issues like you specified.
- NS -
|
|
|
|
|