What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » How to make a struct?

How to make a struct?
Author: Message:
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: How to make a struct?
quote:
Originally posted by Ezra
Hmm, I guess you'll have to do that another way.

Here is some code that I think would help you

Color Picker Made By Matty:
code:
//Show color picker common dialog (Made By Matty);

  //Create our CHOOSECOLOR data block
  var CHOOSECOLOR = Interop.Allocate(36);
  CHOOSECOLOR.WriteDWORD(0, 36); //DWORD lStructSize
  CHOOSECOLOR.WriteDWORD(4, 0); //HWND hwndOwner
  CHOOSECOLOR.WriteDWORD(8, 0); //HWND hInstance
  CHOOSECOLOR.WriteDWORD(12, 0x000000FF); //COLORREF rgbResult (COLORREF = 0x00bbggrr)
  var CustColors = Interop.Allocate(64); //Create an array of 16 COLORREFs for CustColors
  CHOOSECOLOR.WriteDWORD(16, CustColors.DataPtr); //COLORREF *lpCustColors (pointer to our array)
  CHOOSECOLOR.WriteDWORD(20, 3); //DWORD Flags (3 = 2 (CC_FULLOPEN) + 1 (CC_RGBINIT) )
  CHOOSECOLOR.WriteDWORD(24, 0); //LPARAM lCustData
  CHOOSECOLOR.WriteDWORD(28, 0); //LPCCHOOKPROC lpfnHook
  CHOOSECOLOR.WriteDWORD(32, 0); //LPCTSTR lpTemplateName

  //Open the dialog box
  var result = Interop.Call('comdlg32.dll', 'ChooseColorA', CHOOSECOLOR);
  //If the user pressed ok convert it to hex
  if(result == 1){
    //Get decimal values
    var r = CHOOSECOLOR.ReadDWORD(12) & 0xFF;
    var g = (CHOOSECOLOR.ReadDWORD(12) / 0x100) & 0xFF;
    var b = (CHOOSECOLOR.ReadDWORD(12) / 0x10000) & 0xFF;
    Debug.Trace('RGB: ' + r + ',' + g + ',' + b)
    //Get hex values
    var hexchars="0123456789ABCDEF";
    var r = hexchars.charAt((r >> 4) & 0xf) + hexchars.charAt(r & 0xF);
    var g = hexchars.charAt((g >> 4) & 0xf) + hexchars.charAt(g & 0xF);
    var b = hexchars.charAt((b >> 4) & 0xf) + hexchars.charAt(b & 0xF);
    Debug.Trace('HEX: ' + r + g + b);
  }



wtf thats not by matty, i made that :dodgy:
08-01-2006 07:30 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
How to make a struct? - by -=blu3+3y3s=- on 07-31-2006 at 08:51 PM
RE: How to make a struct? - by Ezra on 07-31-2006 at 08:54 PM
RE: How to make a struct? - by -=blu3+3y3s=- on 07-31-2006 at 09:19 PM
RE: How to make a struct? - by Ezra on 07-31-2006 at 09:25 PM
RE: How to make a struct? - by -dt- on 08-01-2006 at 12:00 AM
RE: How to make a struct? - by Eljay on 08-01-2006 at 07:30 AM
RE: How to make a struct? - by Ezra on 08-01-2006 at 09:05 AM
RE: How to make a struct? - by -=blu3+3y3s=- on 08-01-2006 at 06:17 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On