FULL LIST OF AVAILABLE FUNCTIONS ON MSDN: http://msdn.microsoft.com/en-us/library/dd469351(VS.85).aspx SetCursorPos – Move and Click Mouse Cursor Move the cursor postion to somewhere, relative to top left corner of screen Outside of function / in header file: [DllImport(“user32.dll”)] static bool SetCursorPos(int X, int Y); [DllImport(“user32.dll”)] static void mouse_event(unsigned int dwFlags, unsigned int dx, unsigned int dy, unsigned […]
All posts by
Using #pragma Directives
You need to use the /clr compile option. /clr:safe will generate all sorts of errors. You can’t call managed code from the unmanaged code. #pragma unmanaged #pragma managed
P/Invoke (Platform Invoke)
System::Runtime::InteropServices Chapter 22/23 of the ‘Pro Visual C++/CLI and the .NET 3.5 Platform’ book is an excellent resource for understanding P/Invoke (and an excellent VC++ book generally). Used when making calls out of the .NET managed environment to unmanaged .DLLs. P/Invoke finds the DLL, loads it into memory, marshals its arguments (converts from managed to […]
Button Images
Creating Images PNG with transparancy DPI = 72 If using a normal 3D button the button size will need to be the image resolution + 6 Buttons With No Border (Just image but no mouse over or click effect) Button properties Text = [blank] Image = Set Image FlatStyle = Flat FlatAppearance > BorderColor = Set to match background […]
Buttons General
When you want to disable a button but say create a message box when its clicked, or have it still show tool tip text you can use: ->ForeColour = System::Drawing::SystemColors::ControlText //for normal button ->ForeColour = System::Drawing::SystemColors::InactiveCaptionText //for disabled button and then just to a check in the buttons click function.
Create random powerup value from time
Create random powerup value from time DateTime ^DateTimeNow; DateTimeNow = DateTime::Now; SomeVariable = Convert::ToInt32(DateTimeNow->Minute) + Convert::ToInt32(DateTimeNow->Second) + Convert::ToInt32(DateTimeNow->Millisecond); //Create a random startup value
TimeSpan and Calculating Time Difference
TimeSpan vs ^TimeSpan TimeSpan (without caret) is the way to go and makes life easier for comparison operations etc. TimeSpan is a value type so should always be used without the ^. When you use the caret then you get a boxed value that can't be serialized etc. General Usage //Get time difference TimeSpan TimeFromStart; TimeFromStart […]
Date & Time
DateTime vs ^DateTime DateTime (without caret) is the way to go and makes life easier for comparison operations etc. DateTime is a value type so should always be used without the ^. When you use the caret then you get a boxed value that can't be serialized etc. Using DateTime DateTime DateTimeNow; DateTimeNow = DateTime::Now; […]
Labels
Alignment Labels allow both horizontal and vertical allignment (text boxes only have horizontal). However for it to be any use you need to set the minimum size property for the label. Fast Updating Labels are not as good for fast updating values – redraw flickering with large arrays of them Multiline Labels You can use […]
Link (HTTP) Label
A link label is so you can specially open a web link, its a label with underline, change colour type properties. Often just using a click event on a normal label is fine to open a web link. Launching A Web Page In The Systems Default Browser System::Diagnostics::Process::Start(“http://www.ibexuk.com”);
