See Serialization
All posts by
Transparency
Transparency is actually simulated by drawing the pixels of the Parent, which is the form. Therefore you only see the form pixels, stacking effects don’t work. One approach is to just draw the images in the form’s Paint event, or consider WPF which has a very different rendering model that easily supports transparency. […]
URI Encode String
ConvertedString = System::Web::HttpUtility::HtmlEncode(SomeString); ConvertedString = System::Web::HttpUtility::UrlEncode(SomeString); If its not available select project proiperties > Framework & References > add a reference to System.Web HtmlEncode – HTML encoding makes sure that text is displayed correctly in the browser and not interpreted by the browser as HTML. UrlEncode – Encodes a URL string. These method overloads can be used to encode […]
Obtaining Hard Disk Information
using namespace System::IO; try { array<DriveInfo^> ^allDrives = DriveInfo::GetDrives(); for each (DriveInfo ^drive in allDrives) { sTemp += “Drive Name: ” + drive->Name; sTemp += “, Type ” + Convert::ToString(drive->DriveType); if ((drive->DriveType == DriveType::Fixed) && (drive->IsReady)) { sTemp += “, Volume Label: ” + drive->VolumeLabel; sTemp += “, File System: ” + drive->DriveFormat; if (drive->TotalSize […]
UDP Client Simple Transmit Only
UdpClient^ udpClient1; udpClient1 = gcnew UdpClient; IPAddress ^address; int byteId; array<Byte>^sendBytes = gcnew array<Byte>(1500); try { if (!IPAddress::TryParse(DestIpAddressString, address)) { //Invalid IP Address return; } udpClient1->Connect(address, REMOTE_UDP_SOCKET); byteId = 0; sendBytes[byteId++] = ; … sendBytes[byteId++] = ; //Transmit Packet udpClient1->Send(sendBytes, byteId); udpClient1->Close(); } catch (Exception ^) { }
UDP Server
In Your .h File #define RECEIVE_BUFFER_SIZE 1500 private: Socket ^serverSocket; //————————————- //—– CLASS FOR RECEIVE SOCKETS —– //————————————- ref class StateObject { public: property int bufSize; property Socket ^workSocket; property array<unsigned char>^ message; StateObject(Socket^ sock, int bufsize) { workSocket = sock; bufSize = bufsize; message = gcnew array<unsigned char>(bufsize); } }; Create Socket //—– SETUP […]
Reading File Version
try { FileVersionInfo ^FileVersion1 = FileVersionInfo::GetVersionInfo(Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles) + “\\Some Folder\\SomeApplication.exe”); sTemp = “App Version: ” + Convert::ToString(FileVersion1->FileVersion) + “\r\n”; } catch (Exception ^) { }
.Delegates General
A delegate is a pointer to a function in managed C++. Its just like a callback funciton pointer in traditional C++, but more powerful as it deals with the complexity issues and if you want allows you to assign several functions to be called in a single delegate. Avoiding Using Delegates You can pass objects […]
A more complex method originally used
Often when you create a new class you need to provide some method for the new class to pass back information to the original class, or trigger events in the original class. You can have the original class check properties in the new class, but thats no good for events that get generated in the […]
Passing values between forms
To Use A Global Variable Add it to our ap-main.h file – this is automatically included in all files (see creating a project if this file is not in your project) You can’t make strings global – only normal variable types However you can just pass a handle to a string or come other object […]
