|
|
How to check the sign bit in 8 bit integer.? is this MSB? thanks.
|
|
|
|
|
ikbahrian wrote: How to check the sign bit in 8 bit integer.? is this MSB?
Yes.
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.
|
|
|
|
|
Just use a check like this:
if (var<0)
If the variable in of an unsigned type add a cast to the signed version. For example, assume var is an unsigned int :
if (static_cast<int>(var)<0)
Steve
|
|
|
|
|
Hi all, i am a beginer in the area and i did a small program and i get Link errors, can you tell me what is the problem:
file.h
#include <iostream.h>
class CustBase
{
char * custName;
public:
CustBase(){custName=NULL;}
void Print();
};
file.cpp
#include "CustBase.h"
void CustBase::Print()
{
if(this->custName != NULL)
cout<<this->custName<
|
|
|
|
|
ytubis wrote: Main.obj : error LNK2005: "public: void __thiscall CustBase::Print(void)" (?Print@CustBase@@QAEXXZ) already defined in CustBase.obj
The message above comes because in the code below
ytubis wrote: Main
#include "CustBase.cpp"
void main()
{
CustBase a;
a.Print();
}
you have to include the header file (CustBase.h ) not the source one (CustBase.cpp ).
-----------------------------------------------
ytubis wrote: LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/ZCodeProjectWin.exe : fatal error LNK1120: 1 unresolved externals
This one, I think, states that you have choosen the wrong type of project (you should choose Console Application ).
Hope that helps.
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.
|
|
|
|
|
How do I keep an application always on top? just like Winamp does.
*
|
|
|
|
|
Call SetWindowPos[^] onto your window, with the hWndInsertAfter parameter set to HWND_TOPMOST .
|
|
|
|
|
It brings the window to the top, but it's not permanent. It goes back when you click on another window. It should be on top all the time. May be like "System modal".
*
|
|
|
|
|
If you would have read the MSDN page I linked to, you'd have noticed this:
HWND_TOP
- Places the window at the top of the Z order.
HWND_TOPMOST
- Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
|
|
|
|
|
It works! thanks
*
|
|
|
|
|
Hi,
I found a demo software by Microsoft called PlaySound, which shows how to play wave file using DirectX. Everything is cool except it stops playing when the dialog window is deactivated or minimized. I am trying to change it so it would play when window is minimized or deactivated as well.
Would greatly appreciate if someone can help me with this issue.
Thanks,
Alex.
//----------------------------------------------------------------------------
// File: PlaySound.cpp
//
// Desc: The PlaySound sample shows how to load and play a wave file using
// a DirectSound buffer.
//
// Copyright (c) Microsoft Corp. All rights reserved.
//-----------------------------------------------------------------------------
|
|
|
|
|
With the advance from DOS3.3 to Win XP and beyond, One practical issue got lost in the mist.
How do I send an ASCII file to a printer. Admittedly Which Printer?
(Registry Entry somewhere? I can Handle to find the code in the Registry to find an Appropriate entry)
but, essentially, without user intervention or choice, what are the essential steps.
You can see the code I need work every day in the likes of Sainsburry, at the Cash Registers. When one commits a transaction, a Receipt is printed, and the Till Operator was not bothered with questions like on which printer should the receipt be printed, or,formatting questions, etc. This was very simple under DOS. All you did was, create an ASCII file immage with all line lengths, colum allignment etc sorted, and send it to LPT1.
How is it done these days.
On a related topic, How do I 'generically' write code for an additional keypad, like the ones that read a magnetic strip on a charge card (Under DOS accepted as a Text String via stdin)( The latter means that Swiping the card has the same effect as typing it's encoded value on the keyboard), with a keypad to enter a PIN. Such keypad is ofcourse distinct from the standard user qwerty keyboard.
LateNightsInNewry
|
|
|
|
|
Wow. Did you try looking at the articles under "Printing" under the "General C++" section of CodeProject?
led mike
|
|
|
|
|
LateNightsInNewry wrote: With the advance from DOS3.3 to Win XP
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Some body tell me please how to make my application a program that is automatically start up after windows starting up?
In other word what is the function or source code I have to insert to perform that.
Thanks in advance.
|
|
|
|
|
For an application that runs before a user logs in you can make your app a Windows
service application[^]. These typically have no user interface.
There's also a list of startup programs in the registry for both all users and the current user:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
Mark
|
|
|
|
|
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
|
|
|
|