|
An alternative way is putting a shortcut into the autostart start menu folder.
Don't try it, just do it!
|
|
|
|
|
Put it in the [Start][Programs][Startup] menu Option.
This is by far the safest.
LateNightsInNewry
|
|
|
|
|
M26 wrote: automatically start up after windows
If your talking about a normal user mode application and not creating a service, then take a look at this article, Adding your application to the Windows Startup[^]. The article isn't very well written but the class is decent and does indeed work.
Good Luck
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
I'm trying to change the face of a button to a solid color bitmap, but for some reason it's just displaying the button without the bitmap on the front. Here is the code:
CGameOptionsDialog::CGameOptionsDialog(char* lpszName) : CDialog(lpszName)
{
Problem = mem_DC.CreateCompatibleDC(NULL);
CBitSolidBkButton.CreateBitmap(20, 20, mem_DC.GetDeviceCaps(PLANES), mem_DC.GetDeviceCaps(BITSPIXEL), NULL);
mem_DC.SelectObject(CBitSolidBkButton);
NewSolidBkColor = RGB(220, 20, 60);
NewSolidBkBrush.CreateSolidBrush(NewSolidBkColor);
mem_DC.SelectObject(NewSolidBkBrush);
mem_DC.FloodFill(0, 0, NewSolidBkColor);
}
and where SetBitmap is called...
BOOL CGameOptionsDialog::OnInitDialog()
{
CDialog::OnInitDialog();
...
SolidColorSelectButton.Create(" ", WS_CHILD|WS_VISIBLE|BS_BITMAP, CRect(145, 55, 165, 75), this, ID_CHANGE_BK_COLOR);
Gradient1ColorSelectButton.Create(" ", WS_CHILD|WS_VISIBLE|BS_BITMAP, CRect(145, 85, 165, 105), this, ID_CHANGE_GRADIENT1_COLOR);
Gradient2ColorSelectButton.Create(" ", WS_CHILD|WS_VISIBLE|BS_BITMAP, CRect(175, 85, 195, 105), this, ID_CHANGE_GRADIENT2_COLOR);
SolidColorSelectButton.SetBitmap((HBITMAP)CBitSolidBkButton);
if(Problem == FALSE)
MessageBox("Problem", "MSG", MB_OK);
return TRUE;
}
</code>
The "Problem" message box isn't popping up, so I'm pretty shure that the device context got initialized right (it's a class member, so scope isn't an issue). Any ideas on what is wrong? Thanks.
|
|
|
|
|
1) try adding a bitmap resource, and then using that in your line:
SolidColorSelectButton.SetBitmap((HBITMAP)CBitSolidBkButton);
that way you can tell whether it's a bitmap-creation issue OR a button creation issue.
2) You have the line:
mem_DC.SelectObject(CBitSolidBkButton);
Did you select the bitmap back OUT of the device context later on???
|
|
|
|
|
|
I want this in my project.
User key in data in Edit Control and press enter,
then program will get these data for process some job...
My question is
What is the message that occur when user press enter?
I try to use WM_CHAR and WM_KEYDOWN but no work.
Please help me to solve this problem
|
|
|
|
|
For a single line edit control pressing Enter key is the same as clicking the default button
(the button with the BS_DEFPUSHBUTTON style) - typically OK or Cancel in a dialog.
If you want to catch the Enter key press you can do it in response to a WM_KEYDOWN message sent
to the edit control but the edit control needs the ES_WANTRETURN|ES_MULTILINE styles set.
Mark
|
|
|
|
|
The other poster answered your question, but for future reference on other message questions, add a "PreTranslateMessage" in your dialog and you can see all the messages that come through.
|
|
|
|
|
Actually I want to generate random 12 bit unsigned int and random 4 bit signed int and stores in 2 bytes(unsigned int) which is as follow.
2 bytes unsigned int = 12 bit unsigned int*pow(10,4-bit signed int)
Thanks in advance-
|
|
|
|
|
If you have NOT constraints on the ranges of both the 12-bit unsigned numbers and 4-bit signed ones, then you can generate and store directly a 16-bit unsigned random number (the result is the same).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
no dear I have to take in to account the range and the storage.
|
|
|
|
|
OK. What are the constraints on the ranges?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
unsigned int 12 bit (0 -> +4095)
the size should be 12 bit;
signed int 4 bit (-16 -> +15)
the size shoud be 4 bit;
thx.
|
|
|
|
|
Processors can only access memory by 8-bit blocks, i.e. bytes.
If spaces is a criterion, you'll need to pack your 12-bit values into bytes yourself. You can for example store them like this:
8-bit bytes : XXXXXXXX YYYYYYYY ZZZZZZZZ
12-bit values: JJJJJJJJ JJJJKKKK KKKKKKKK
i.e. use 3 bytes to store 2 12-bit values.
To store and extract the values, use simple bit-shifting. For mapping the 4-bit parts to signed ints, you can either use a lookup table or write a simple function that gets the MSB of the 4-bit value and map it to the MSB of the byte and adjust the rest accordingly.
|
|
|
|
|
ikbahrian wrote: signed int 4 bit (-16 -> +15)
You're wrong, since -8->+7 is the range for a 4-bit signed number. Moreover, you're NOT imposing constraints over ranges (you want to fully exploit ranges) hence you can safely follow the suggestion posted below by Joergen Sigvardsson
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
uint16 num = uint16(rand() % 65535) should do the trick. To get the components from the number:
uint16 n12bit = num & 4095;
int8 n4bit = ((num >> 12) & 7) * (((num >> 12) & 8) ? -1 : 1);
[edit]Per Mark's bug report! {/edit]Last modified: 36mins after originally posted --
|
|
|
|
|
Good answer!
I would change 1 thing - use those unused upper 4 bits instead of reusing the lower 4
int8 n4bit = ((num >> 12) & 7) * ((num & 8) ? -1 : 1);
(per the OPs spec )
Cheers!
Mark
|
|
|
|
|
int8 n4bit = ((num >> 12) & 7) * (((num >> 12) & 8) ? -1 : 1); Good catch! I also fixed your code a little (you forgot to shift for getting the sign bit)
|
|
|
|
|
Thanks!
|
|
|
|
|
|
You can also use a union to extract the components
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: You can also use a union to extract the components
Going for extra credit - Yeah!
|
|
|
|
|
thanks
|
|
|
|
|
One thing that hasn't been suggested yet is to use bitfields:
USHORT twelvebitnum :12;
USHORT fourbitnum :4;
Now you can generate your 12-bit number and your 4-bit number and simply
twelvebitnum = 3500;
fourbitnum = 5;
These two values are actually stored in a single 16-bit USHORT. The location of these within the USHORT are insignificant since you access them by the variable name, but the first one defined starts with the lowest x-number of bits, then the next one takes the next y-number of bits, and so on.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|