Originally posted by zeitghost
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Reply to: VS C++ Express Registration
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "VS C++ Express Registration"
Collapse
-
Originally posted by suityou01 View Post
It's not just me.
A lot of these modern framework implementations make things quite bulky, when they could be elegant.
Ponders. Another plan B?
Leave a comment:
-
There are already zillions of wrappers around frameworks. It arguably makes the framework easier, but then is one more library for a developer to learn, and means two developers may know different wrappers for the same framework.
Leave a comment:
-
Originally posted by VectraMan View PostFrom here:
http://www.c-sharpcorner.com/UploadF...enCapture.aspx
Code:// Create a bitmap from the Windows handle Bitmap image = new Bitmap(Image.FromHbitmap(new IntPtr(hBitmap)), Image.FromHbitmap(new IntPtr(hBitmap)).Width, Image.FromHbitmap(new IntPtr(hBitmap)).Height);
It's not just me.
A lot of these modern framework implementations make things quite bulky, when they could be elegant.
Ponders. Another plan B?
Leave a comment:
-
From here:
http://www.c-sharpcorner.com/UploadF...enCapture.aspx
Code:// Create a bitmap from the Windows handle Bitmap image = new Bitmap(Image.FromHbitmap(new IntPtr(hBitmap)), Image.FromHbitmap(new IntPtr(hBitmap)).Width, Image.FromHbitmap(new IntPtr(hBitmap)).Height);
Leave a comment:
-
SuitYou, can I recommend StackOverflow to you? Worth a try for this kind of thing.
Leave a comment:
-
Originally posted by NickFitz View PostYou haven't even said what doesn't work, so it's unlikely anybody will be able to help. Does it fail to compile? Does it compile but throw a runtime exception? Does it compile and run without crashing but not do what you expect it to?
VS has a very good debugger, and it's only a few lines to step through to identify the precise point of failure, at which point looking at the MSDN docs for the relevant API call will probably point you in the right direction. Search on Raymond's blog for the relevant function's name as well, as he often mentions various gotchas and he's written loads about GDI in the past.
I have fixed it. And am posting the code back here like a good little boy.
Code:public Bitmap CaptureScreenToPictureBox(int hDcPbx) { int hdcSrc = User32.GetWindowDC(User32.GetDesktopWindow()), hdcDest = GDI32.CreateCompatibleDC(hdcSrc), hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc,200, 200); GDI32.SelectObject(hdcDest, hBitmap); GDI32.StretchBlt(hdcDest, 0, 0,200,200, hdcSrc, 0, 0,1200,800, 0x00CC0020); Bitmap screenShot = Image.FromHbitmap((IntPtr)hBitmap); return screenShot; }
Then the call is changed thusly
Code:Example f = new Example(); this.pictureBox1.Image = f.CaptureScreenToPictureBox(this.pictureBox1.CreateGraphics().GetHdc().ToInt32());
Leave a comment:
-
Originally posted by suityou01 View PostIncidentally this is the second forum that cannot point me in the right direction with this code.
VS has a very good debugger, and it's only a few lines to step through to identify the precise point of failure, at which point looking at the MSDN docs for the relevant API call will probably point you in the right direction. Search on Raymond's blog for the relevant function's name as well, as he often mentions various gotchas and he's written loads about GDI in the past.
Leave a comment:
-
Originally posted by suityou01 View PostIncidentally this is the second forum that cannot point me in the right direction with this code.
[apart from VectraMan]
edit : [and NF]
HTH
Leave a comment:
-
Originally posted by NickFitz View PostYou've spelt "Picture" wrong in your method name, although you've also spelt it wrong in the method invocation. One of the pitfalls of IntelliSense
You're not a consultant by any chance are you
Leave a comment:
-
Originally posted by suityou01 View PostWorked like a charm. Which is more than I can say for my code.
Code:public void CaptureScreenToPitureBox(int hDcPbx) //NB this is part of a class called Example { int hdcSrc = User32.GetWindowDC(User32.GetDesktopWindow()), hdcDest = GDI32.CreateCompatibleDC(hdcSrc), hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc, GDI32.GetDeviceCaps(hdcSrc, 8), GDI32.GetDeviceCaps(hdcSrc, 10)); GDI32.SelectObject(hdcDest, hBitmap); GDI32.BitBlt(hdcDest, 0, 0, GDI32.GetDeviceCaps(hdcSrc, 8), GDI32.GetDeviceCaps(hdcSrc, 10), hdcSrc, 0, 0, 0x00CC0020); GDI32.StretchBlt(hDcPbx, 0, 0, 100, 100, hdcSrc, 0, 0, 1200, 800, GDI32.SRCCOPY); }
Code:Example e = new Example(); Graphics pbG = this.pictureBox1.CreateGraphics(); e.CaptureScreenToPitureBox(pbG.GetHdc().ToInt32());
Leave a comment:
-
Originally posted by NickFitz View Post"You can obtain a new valid registration key by revisiting online registration. Just click the registration link in the “Register Product…” dialog and follow the instructions. You will be provided a new registration key." - MS VSE Registration FAQ.
The "Register Product..." dialog is accessed from the Help menu.
I haven't registered a copy in a while, but IIRC you cut & paste the key from the registration web site into VSE. For some reason they don't send it to you by email.
EDIT: oh, and I thought they allowed you to use it for thirty days before registering, although I suppose they may have changed that.
Code:public void CaptureScreenToPitureBox(int hDcPbx) //NB this is part of a class called Example { int hdcSrc = User32.GetWindowDC(User32.GetDesktopWindow()), hdcDest = GDI32.CreateCompatibleDC(hdcSrc), hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc, GDI32.GetDeviceCaps(hdcSrc, 8), GDI32.GetDeviceCaps(hdcSrc, 10)); GDI32.SelectObject(hdcDest, hBitmap); GDI32.BitBlt(hdcDest, 0, 0, GDI32.GetDeviceCaps(hdcSrc, 8), GDI32.GetDeviceCaps(hdcSrc, 10), hdcSrc, 0, 0, 0x00CC0020); GDI32.StretchBlt(hDcPbx, 0, 0, 100, 100, hdcSrc, 0, 0, 1200, 800, GDI32.SRCCOPY); }
Code:Example e = new Example(); Graphics pbG = this.pictureBox1.CreateGraphics(); e.CaptureScreenToPitureBox(pbG.GetHdc().ToInt32());
Leave a comment:
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Expert Accounting for Contractors: Trusted by thousands Yesterday 14:47
- Finish the song lyric Yesterday 12:05
- A quick read of the taxman’s Spotlight 67 may not be enough Yesterday 09:27
- Contractor MVL Solution from SFP Dec 11 12:53
- Gary Lineker and HMRC broker IR35 settlement on the hush Dec 11 09:10
- IT contractor jobs market sinks to four-year low in November Dec 10 09:30
- Joke of the Day Dec 9 14:57
- How company directors can offset employer NIC rising to 15% Dec 9 10:30
- Contractors, seen Halifax’s 18-month fixed rate remortgage? Dec 5 09:59
- Contractors, don’t be fooled by HMRC Spotlight 67 on MSCs Dec 4 09:20
Leave a comment: