|
hi all,
i am trying to get the active window asw a bitmap, an earlier post directed me to the GetForegroundWindow() function in user32.dll
this however (with the code below) is returning both my desktops as the bitmap not the active window.
can any please help?
internal static Bitmap GetForegroundWindowBitmap()
{
IntPtr handle = GetForegroundWindow();
IntPtr windowDC = GetWindowDC(handle);
Bitmap windowImage = GetBitmap(windowDC);
ReleaseDC(windowDC);
return windowImage;
}
internal static Bitmap GetBitmap(IntPtr imagePtr)
{
IntPtr hwnd = GetCurrentObject(imagePtr, 7);
Bitmap desktopImage = Image.FromHbitmap(hwnd);
return desktopImage;
}
the above code (GetBitmap) works fine to get 'a' desktop or all desktops if i pass in GetDC(GetDesktopWindow())
kind regards,
g00fy
|
|
|
|
|
The below mentioned code which came in a posting in code project is working with win 2k3 box but when i try to execute the same in a winxp sp2 box it is throwing a Generic Failure error. can some one help me in fixing this problem
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("Select Name from Win32_CDROMDrive");
foreach(ManagementObject cdrom in searcher.Get())
{
Console.WriteLine("Name: {0}\n",
cdrom.GetPropertyValue("Name"));
}
Thanks
Vinu
|
|
|
|
|
I have application i want get Event when click Control + Enter
how will i do ???
|
|
|
|
|
Hello
first set your forms KeyPreview property to "true",
then on controls KeyPress event do your job like below code :
<br />
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)<br />
{<br />
if (e.KeyChar == Keys.Enter)<br />
{<br />
....<br />
}<br />
}<br />
if this can not help you mail me please.
Bye Bye.
|
|
|
|
|
freshonlineMax wrote: if this can not help you mail me please.
Public forum, public answer. Follow up questions & Answers should be posted here for everyone's benefit.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
thanks but i want
Event when click Control after continue click Enter
(Example when u open IE u write name some web site(xxx) after u click Control + Enter---> xxx.com )
|
|
|
|
|
hi AnhTin!
so what you mean is when the user PRESS Control + Enter?
if your subclassing a control just override the OnKeyDown event
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyData == (Keys.Control | Keys.Enter))
{
}
}
or if your just using the control... attach an event handler on the KeyDown event then do the same condition that i added in the onkeydown event.
hope that helps!
microsoc
|
|
|
|
|
|
No problemo dude!
microsoc
|
|
|
|
|
Hi
how i can take data for every visitor of my web for example ip address name of computer or something else???
please hepl
best regard\s
|
|
|
|
|
|
thank's a lot brather.:->
|
|
|
|
|
hi
my access db include password and i want connect to it in vs.net and when i drag oledbdataadapter to my form and configurate parameters (select provider,enter password) and click on test connection , the following message show me :
Server Explorer
---------------------------
Unable to connect to database.
Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
---------------------------
OK
Access db was closed.
how to solve my problem ?
|
|
|
|
|
Sounds like a lock file exists in the folder, which indicates that the database is already open.
And you should stick to adding data code as code, not using the design view. Database code never belongs in the UI layer, therefore should never be added with the designer.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I need to export the data of a datagrid to csv.
-- modified at 3:18 Thursday 4th May, 2006
|
|
|
|
|
|
Hi,
I have a producer, and each producer has a number of different facilities. I can manage to get the producer to select his different facilities and writing this to a database. But when retrieving the producer facilities and setting the items he selected to true is what I'm struggling to do. The SelectionMode is set to Multiple.
Can someone please share some advice. I have searched Google yesterday and today, but can't find anything.
If there any good articles, please let me know.
Regards,
ma se
|
|
|
|
|
hi friend i building application by C# to webBrowser
i want edit proxy and some attribute (process bar when load web site to computer) of internet Explore
i hope someone help me
AnhTin
-- modified at 1:58 Thursday 4th May, 2006
|
|
|
|
|
hi all,
how can i use win api to get the active program on the system please.
if am trolling through alot of sites and not finding anything. I can get the window from it text and activate it and a hand full of other things but not able to find the active window.
does anyone know a function to achieve this?
kind regards,
g00fy
|
|
|
|
|
Try this:
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
DigitalKing
|
|
|
|
|
thanx DigitalKing,
the reference i was looking at said that took and IntPtr as param, apparently not cause it works perfect.
thanx again
g00fy
|
|
|
|
|
Hi everyone,
I created a C# Windows Service that references Microsoft Outlook 11.0 Object Library. The service got registered and run fine except that it failed whenever it tried to refence this object. I had the exact same code running completely fine in Windows Application.
I did google and found some recommendation on using CDO or MAPI but I don't quite know what they are and how to use them to solve this problem.
Any help is strongly appreciated.
Thanks,
Bunnycool
|
|
|
|
|
Getting tired now but my first thought is that it is a session problem ( windows account ). The service is probably running under the system account and the Outlook DOM being COM is probably not registered for that account. While it might be possible to register Outlook under the system account, there are security issues raised when running a service under the system account. So probably the best thing to do is run the service under a user account that Outlook is registered for.
Or that could be totaly wrong.
led mike
|
|
|
|
|
1) Outlook won't run without a desktop to show it's little warning boxes.
2) Outlook won't run with more than one session on one machine.
Try and use CDO 1.21 in your service. CDO can do the same things Outlook does.
You'll need this site for constant declarations and examples: http://www.cdolive.com/[^]
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
Thanks so much for you guys's response.
I will try your suggestion tomorrow.
|
|
|
|