|
It sounds like your bracket symbol (the #ifdef... #define... #endif stuff) may be misspelled someplace.
Software Zen: delete this;
|
|
|
|
|
does anyone know if static libs (non MFC) built with VS.Net 2003 can be used in VS.Net '02 ?
-c
To vote with no response is to follow the way of the coward.
|
|
|
|
|
How to get a random number of BYTE type
|
|
|
|
|
BYTE b = (BYTE)( rand () % 256);
Iain.
|
|
|
|
|
It's so easy!
Thank you.
|
|
|
|
|
How can I make a function to do rand() work?
<marquee>Hosam Aly Mahmoud
|
|
|
|
|
Maybe a random number can be generated as following ways:
1.serial numbers;
2.A mathimatial way, which requires:
(1)Irrelevant;
(2)Diffusing;
(3)Shifting;
(4)Inter-Action;
and so on.
Herein I just have a free think, however, I don't know the how-to-do details.
|
|
|
|
|
This could be one of two questions:
1) How can I use the rand () function?
or
2) How can I write my own pseudo random number generator?
In answer to (1), it's quite simple. Just look up the rand function in MSDN to get the right
header file to include (stdlib.h as I remember). Then use the function which returns a pseudo
random integer. Use that as you wish...
In answer to (2), don't! There's been a LOT of brainy people doing a large amount
of work over the last several decades coming up with algorithms which return a close-to-
random number. Just use their work. For those rare examples which require a truly random
number generator (high level cryptography, weather prediction) they use a real world random
phenomenon (e.g. Cosmic ray incidence etc) and measure that.
If you can write a better random number generator than is alreay in use, you'll need more
knowledge that I can give, but you'd earn a professorship...
Iain.
|
|
|
|
|
It depends on how random you want it. As the poster above suggests, using rand() is fine.
However, the Crypto API has a random data functions called CPGenRandom() and CryptGenRandom() - I've never used them, but I would suspect they would generate "better" random data, going by the documentation in MSDN
--
Ian Darling
|
|
|
|
|
Hi, it's hard for me to describe exactly what i'm looking for but i'll give it a shot.
I've been learning assembly lately and looked at some code that used an interrupt to print some text to the screen. The assembly program could then be written to a disk in the bootsector and the program could be run on boot, like a small operating system (of course its not really an operating system since it only prints text). But now i was wondering, since C is translated in assembly and since its just sort of a mean to keep your code structured and readable, if you could write pure C code that can be executed on boot without needing any libraries or any of that, so it would basically have the same result as the assembly code i mentioned earlier. Would this code just be assembly code in a C syntaxis (like you can still use functions and preprocessors like in C) or would it be possible in in just.. well C. I don't know much about low level C. If anyone could show me an example of what a C program looks like that can be run on boot, without anything else running/installed on the PC, that would be great (if it exists of course but i figured it does since a lot of operating systems are written in C).
Perhaps you would need a special C compiler?
Thanks for your help
Kuniva
--------------------------------------------
|
|
|
|
|
It's not easy, but possible. You need a compiler that can compile to a raw binary image (not an .EXE file), and it must be able to start the code at the first location in the file. If you use multiple files, then you'll need a linker that supports raw binary output files. A good place to start is http://my.execpc.com/~geezer/johnfine/[^], which give a few links, some sample source code, and some utilities, including a linker specially written for doing this (jloc).
The DJGPP[^] development environment is excellent for low-level work like this.
It is possible, but you will need to use a special compiler/linker. I have used the DJGPP/jloc system and it works well (a few years ago, though...).
BTW, using the C libraries are not a problem, as long as they don't call any OS functions, such as memory management. The DJGPP system includes a series of C libraries that meet this requirement.
Hope this helps
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Yea, this helps a lot, thanks, i already worked with the DJGPP environment before so shouldn't be a problem
Kuniva
--------------------------------------------
|
|
|
|
|
Hi fren,
i am not sure how to link the related comboBox in the C++. Actually i would like the comboBox related in this way, such as the 1st combobox may consist the data called Food, Beverage. Then i wan the 2nd combo box will consist the data which is link to the selection of the 1st combobox. that's mean if user select Food, my 2nd combobox will onli list out- sandwiches, pasta, etc. wherelese if user select beverage will list out - coffee, coke,etc.
Hope u get what i mean. Thanks for your help!!!
|
|
|
|
|
One solution is to design an algorithm and update the controls manually.
Kuphryn
|
|
|
|
|
Is it i should use a event called OnselendokTypeDetail?? in this event i will retrieve the data from the database and assign it to combobox2 when the user have selected the data from combobox1 such as:
m_TypeDetail.Execute(0,1, T_("Select TypeDetailId, Description From tbl_TypeDetail where TypeId = %dcb",) &m_Type);
combox1 member variable = m_Type, combobox2 member variable = m_TypeDetail
|
|
|
|
|
How do I embed and use a font resource in application?
Please send a sample.
Thanks.
|
|
|
|
|
You can create binary resources that are basically the contents of a LOGFONT structure. When you need to create the font, you will need to load the resource and call CreateFontIndirect, passing the logfont pointer.
onwards and upwards...
|
|
|
|
|
Did you ever get this working?
Cheers
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
hi, i try to play around with ON_UPDATE_COMMAND_UI but i didn't get wat i want
i put the following macro in my message map:
===
ON_COMMAND(ID_FACEREDETECTION_DISABLE, OnFaceredetectionDisable)
ON_UPDATE_COMMAND_UI(ID_FACEREDETECTION_DISABLE, OnUpdateFaceredetectionDisable)
===
void CXFaceRecognitionDlg::OnUpdateFaceredetectionDisable(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
MessageBox("OnUpdateFaceredetectionDisable", "OnUpdateFaceredetectionDisable", MB_OK);
pCmdUI->SetText ("New Text");
}
when i click on that menu, i get the message box. however, the text of the menu won't change ??
can anyone tell me why this happen??
thank you.
regards
yccheok
p/s ya. i am developing dialog based application and i just add the menu by manually editing the resource file.
====
IDD_XFACERECOGNITION_DIALOG DIALOGEX 0, 0, 299, 263
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "FaceRecognition .NET"
MENU IDR_MENU1
===
|
|
|
|
|
Here is one solution from MSDN.
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B242577
Kuphryn
|
|
|
|
|
Add a handler for WM_KICKIDLE to your msg map (it's not in ClassWizard since it's an undocumented MFC message, so you'll need to edit the msg map manually). You may need to #include afxpriv.h to get the definition of WM_KICKIDLE . In the handler, call UpdateDialogControls(this, false);
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Wow, this is an old reply, but thanks for posting this.
|
|
|
|
|
Hi,
In my program, I use asynchronies dial up connection with rasapi32 api.
From RasDialFunc, after RASCS_AuthNotify, I can’t get any other message.
Anybody knows why this happens?
Here is my RasDialFunc code.
VOID WINAPI RasDialFunc(UINT unMsg, RASCONNSTATE rasconnstate, DWORD dwError)
{
if ( dwError )
{
char szBuf[256];
if ( RasGetErrorString( dwError, (LPSTR)szBuf, 256 ) != 0 )
{
wsprintf( (LPSTR)szBuf, "Undefined RAS Dial Error (%ld).", dwError );
RasHangUp( g_hRasConn );
MessageBox(NULL, (LPSTR)szBuf, "Agni Dialer", MB_OK | MB_ICONSTOP );
}
return;
}
g_nLastRASConnState = rasconnstate;
LPCTSTR lpszMsg;
switch ( rasconnstate )
{
case RASCS_OpenPort : lpszMsg = "Openning Port"; break;
case RASCS_PortOpened : lpszMsg = "Port Opened"; break;
case RASCS_ConnectDevice : lpszMsg = "Connecting Device"; break;
case RASCS_DeviceConnected : lpszMsg = "Device Connected"; break;
case RASCS_AllDevicesConnected : lpszMsg = "All Devices Connected"; break;
case RASCS_Authenticate : lpszMsg = "Starting Authentication"; break;
case RASCS_AuthNotify : lpszMsg = "Authentication Notify"; break;
case RASCS_AuthRetry : lpszMsg = "Authentication Retry"; break;
case RASCS_AuthCallback : lpszMsg = "Callback Requested"; break;
case RASCS_AuthChangePassword : lpszMsg = "Change Password Requested"; break;
case RASCS_AuthProject : lpszMsg = "Projection Phase Started"; break;
case RASCS_AuthLinkSpeed : lpszMsg = "Link Speed Calculation"; break;
case RASCS_AuthAck : lpszMsg = "Authentication Acknowledged"; break;
case RASCS_ReAuthenticate : lpszMsg = "Reauthenticatation Started"; break;
case RASCS_Authenticated : lpszMsg = "Authenticated"; break;
case RASCS_PrepareForCallback : lpszMsg = "Preparation For Callback"; break;
case RASCS_WaitForModemReset : lpszMsg = "Waiting For Modem Reset"; break;
case RASCS_WaitForCallback : lpszMsg = "Waiting For Callback"; break;
case RASCS_Interactive : lpszMsg = "Interactive"; break;
case RASCS_RetryAuthentication : lpszMsg = "Retry Authentication"; break;
case RASCS_CallbackSetByCaller : lpszMsg = "Callback Set By Caller"; break;
case RASCS_PasswordExpired : lpszMsg = "Password Expired"; break;
case RASCS_Disconnected : lpszMsg = "Disconnected"; break;
case RASCS_Connected : lpszMsg = "Connected"; break;
}
g_csStatusMsg = lpszMsg;
}
|
|
|
|
|
MUuu..
Kuniva
--------------------------------------------
|
|
|
|
|
I've been reading Code Project for quite some time now, and this is the first question I've posted. I'm hoping the collective brain power here can help me track down a problem I'm having.
I have an application (written by me) that seems to be causing the windows clock (but not the RTC) to drift forward in time severely (say 24 seconds over 5 minutes) The application has a number of threads (maybe around 10) and services many TCP connections where the input/response packets are relatively small (90bytes to 1500 bytes)
I am at a loss to think what would make an application cause the windows clock to GAIN time. The processor utilization stays fairly low (below 30%) and it does not consume other resources at an unexpected rate. I was thinking maybe Windows is missing the time update interrupt and over compensating, but I don't believe this is true...
The truly odd thing is that I have a couple of other apps that do very similar tasks which share all the underlying code that this app does, which do NOT cause this problem.
Can anyone think of what to look for, or what to try to narrow the problem down?
Thanks,
Gavin Stark
|
|
|
|
|