|
sorry atoi
regards,
Rookie
|
|
|
|
|
Rookieee wrote:
int i;
CString str = "32";
sscanf(str, "%d", &i);ASSERT(i == 32);
int i;
CString str = "32";
sscanf(str, "%d", &i);ASSERT(i == 32);
watz wrong with this ^?
vivek
|
|
|
|
|
vivekuniq wrote:
Rookieee wrote:
int i;
CString str = "32";
sscanf(str, "%d", &i);ASSERT(i == 32);
watz wrong with this ^?
sorry but, this sample is mine, not Rookieee's...
and of course is works
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
What is the best way to store 1000000 serial number of 6 numbers?
What type should i use?
/\|-||\/|/\|)
|
|
|
|
|
sorry ?
what exactly is the question ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I can have at max 1000000 serial number. I need to store them in an array or somth knowing that the lenght of each serial number is always 6 numbers
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
1000000 serial number of 6 numbers
an array of 1,000,000 elements of 6 digit each? __int16 is too short so __int32.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
From the msdn website: "Note that the __int8 data type is synonymous with type char, __int16 is synonymous with type short, and __int32 is synonymous with type int". However, if you use MS VC++ on windows, the max integer value you can use with int is 32,767 if signed or twice that if unsigned. What you need is a long int that can take 2,147,483,647 or twice that if unsigned. If you need bigger values then __int64 works... partially... there seems to be a whole lot of things that are not supported for that data type in C++ but seem to work fine in C.
Cheers
|
|
|
|
|
__intN[^] are platform independent data types, they are synonims for the ANSI data types.
Cheers,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I have a problem with printing.
When I print image it's very small on paper, but big on the screen.
So I decide to add code:
int logxPrn=GetDeviceCaps(hPrinterDC,LOGPIXELSX);
int logxScr=GetDeviceCaps(hDisplayDC,LOGPIXELSX);
But this values are same.Why?
int logxPrn=GetDeviceCaps(hPrinterDC,HORZRES);
int logxScr=GetDeviceCaps(hDisplayDC,HORZRES);
This values are too same!!!
Can Anyone Help me?
|
|
|
|
|
I had a similar problem that required me to use something like:
SetMapMode(hDC, MM_ISOTROPIC);
SetWindowOrg(hDC, bitmap_width / 2, bitmap_height / 2);
SetViewportOrg(hDC, GetDeviceCaps(hDC, HORZRES) / 2, GetDeviceCaps(hDC, VERTRES) / 2);
SetWindowExt(hDC, bitmap_width, bitmap_height);
SetViewportExt(hDC, GetDeviceCaps(hDC, HORZRES), GetDeviceCaps(hDC, VERTRES));
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
DavidCrow Can you explain me
How to use your code and how it works?
|
|
|
|
|
Are you using MFC?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
Then put this code in the view's OnPrepareDC() method after calling the base implementation:
if (pDC->IsPrinting() != FALSE)
{
pDC->SetMapMode(MM_ISOTROPIC);
pDC->SetWindowOrg(m_BmpInfo.bmWidth / 2, m_BmpInfo.bmHeight / 2);
pDC->SetViewportOrg(pDC->GetDeviceCaps(HORZRES) / 2, pDC->GetDeviceCaps(VERTRES) / 2);
pDC->SetWindowExt(m_BmpInfo.bmWidth, m_BmpInfo.bmHeight);
pDC->SetViewportExt(pDC->GetDeviceCaps(HORZRES), pDC->GetDeviceCaps(VERTRES));
}
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi all,
I have created a setup for an application. When I perform an upgrade operation using this setup, currently the logon information is read from a file(setup.inf). It includes username, password, servername and database name. Now I don't want to depend on this setup.inf file. Instead at the time of upgradation, the setup should read this information from the DSN already created. If anyone knows how to do this then please tell me.
Thanking You.
Regards,
Harshad
|
|
|
|
|
System DSN are stored in the registry at HKEY_CURRENT_USER/SOFTWARE/ODBC/OBBC.INI
youc can read the DSN named key.
Ritu Kwatra
|
|
|
|
|
Hi
I have a TabCtrl. The user should finish the operation on Tab 1 (press a button in the tab 1) before being able to access Tab 2 and the others.
How can i make this restriction?
/\|-||\/|/\|)
|
|
|
|
|
hi
On button of Tab1 declare the extern global value set to specific value and on tab2 check that value if u get that allow it or else set the focus to tab1
cheers
|
|
|
|
|
I write a program,use the global msg hook.Although the wm_keydown 、wm_mousemove and other msg can hook,but the wm_destroyclipboard、WM_DRAWCLIPBOARD and other clip msg cann't hook.
Can anyone tell me why?How can i to do ? Thanks a lot!
hook = SetWindowsHookEx(
WH_GETMESSAGE,
(HOOKPROC)msghook,
hInstance,
0);
---------------------
if(code < 0)
{ /* pass it on */
CallNextHookEx(hook, code,
wParam, lParam);
return 0;
} /* pass it on */
LPMSG lpEvent = (LPMSG)lParam;
if( lpEvent->message == WM_DESTROYCLIPBOARD)
{
MessageBox(NULL,"click!","click",MB_OK);
nn=FALSE;
}
// Pass the message on to the next hook
return CallNextHookEx(hook, code,
wParam, lParam);
|
|
|
|
|
There is modal dialog and on its DoModal() we start a thread
CPBarDlg dlg;
dlg.DoModal();
BOOL CPBarDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_event = CreateEvent(0,true,false,0);
p->event = m_event;
p->quit = 0;
pTH = AfxBeginThread((AFX_THREADPROC)&annthread,p,0,0,0,0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPBarDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
p->quit = 1;
WaitForSingleObject(m_event, INFINITE); //returns when m_event in signaled state
//hang here sometimes in Release mode??????
CloseHandle(m_event);
CDialog::OnClose();
}
/////////////////////////////////////////////////////////////////////////////
//////////////////////////////THREAD/////////////////////////////////////////
UINT annthread(LPARAMS p)
{
while(!p->quit)
{
//do some calculations.... req about 10-20ms
}
SetEvent(p->event);
return 0;
}
///////////////////////////////////////////////////////////////////////////////
So in order to end thread before we close CPBarDlg we set p->quit = 1 and wait untill event signaled by thread. But it is not set in thread in Release mode and OnClose() handler start to wait forever for WaitForSingleObject(m_event, INFINITE)??? whats wrong
9ine
|
|
|
|
|
Did you declare the quit variable with the volatile modifier?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
why? no I didnt. it is just a structure
typedef struct _params
{
int quit;
HANDLE event;
...
...
etc...
}PARAMS p, LPARAMS *p;
and then just:
PARAMS p; //in dialog header file
and
p.quit = 0;
p.event = ...
... etc
beforecreating a thread and passing PARAMS to it.
9ine
|
|
|
|
|
You need to declare quit as volatile, which guarantees that the compiler won't do any optimization, which is what is happening in your case. The compiler probably decided that quit was not being modified in the while loop and decided to ignore the check altogether.
Declaring it as volatile prevents the compiler from doing that optimization, my guess is that would solve your problem.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
yes I choosed optimization in Release mode, interesting that it prevents checking variable if it is not modified in while loop ) . I noted that it is terminated about 1 to 4 not terminated cases. Will check it with volatile mod.
9ine
|
|
|
|