|
I've installed the WinXP debug symbols, they work fine with VS.NET but VS 6.0
cannot load the debug symbol. Do you know if there is any incompatibility
or what do I need to do to let VS 6.0 to load the symbols ?
|
|
|
|
|
How do i round a number to the nearest integer?
|
|
|
|
|
int i;
double d;
i = (int)d; // cut decimals
i = (int)(d+.5); // round upwards
/Magnus
|
|
|
|
|
float fVal ;
..
..
//Assuming we need to round fVal
int nNum = (int) fVal ;
int nRoundedVal = ((fVal-nNum)> 0.5f) ?nNum+1:nNum ;
|
|
|
|
|
The key to remember is that cast a real number (double or float) to an integer results in truncation. Therefore, to round to the nearest integer here is what you do :
int integervalue = (int)( doublevalue + 0.5 );
Write some test code a try it.
|
|
|
|
|
Hello,
I use the right mouse button to start to rotate dynamically an object
until the user clicks again on the right button when he is satisfied of the
rotation. And it hase worked fine since years.
Anyway, I would like to add a contextual popup CMenu on the right mouse
button .
But I want to keep my good old rotation at the mouse. So I want to :
- display the popup menu and keep it displayed.
- if the user moves the mouse I go on rotating the object ("under" the menu)
until ...
- he clicks the right button : then I want to ignore the menu
- OR he clicks the left button because he has chosen something from the
menu, the I ignore the rotation.
My problem, is that I do not know how to do that : when I add the the CMenu
in classic MFC programming, I have no more control on the position of the
mouse....
Has a guru an idea? To get some message when the mouse moves?
Thank you all
Pierre Couderc
Pierre Couderc
|
|
|
|
|
Hi,
I sometimes have problems when retreiving the CommMask with the GetCommMask function.
Most of the times the funtion returns with success, but sometimes, for example when I've run an application (Hyperterminal for example) on the serial port and then run my application, the GetCommMask returns in failure. When retreiving a GetLastError I get "WARNING: WaitCommEvent() Failed with the following error: The I/O operation has been aborted because of either a thread exit or an application request".
Pleeeeease help me.
Dejan
|
|
|
|
|
If you just open the communication port. "Personally" I don't think you
need to worry about GetCommMask() returned value since you need to set
to receive events: SetCommMask, right?
If you need to verify current Comm Mask event, you need to care only after
your own SetCommMask call!
Hope this help you,
Good luck
"One good thing about getting older, you don't lose the ages you've been!"
|
|
|
|
|
Thanx Ernest,
but the SetCommMask() return value is TRUE (function succeded).
The GetCommMask() funtion returns false, I can't ignore this because I don't get the the bit set that signals a BREAK signal which it should, and which I get when it functions "the normal way" i.e. when the GetCommMask() funtion returns true.
/Dejan
|
|
|
|
|
Hi
I need some infotmation on how to communicate with USB devices. However, I have not the smallest clue how to begin. What API function do this job?
Any information or sample code (pure c or vc++) would be very nice
regards
Gregor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I guess those devices have drivers. Maybe you can use them directly to communicate with the devices.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
That entirely depends on the USB peripheral you're trying to communicate with. For instance, if it's a memory stick or a camera you would use various standard Win32 API calls.
I've just finished designing a custom USB peripheral that uses an off-the-shelf USB interface chip. In this case, the chip's manufacturer (FTDI) provides a DLL and import library with various functions one can call. Almost too easy!
|
|
|
|
|
I'm always having this error.
{ ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); }
CInfoDlg is derived from CDialog and is a resource
m_cList is a CListCtrl
CInfoDlg dlg;
for(int nIndex=0;nIndex<nMax;nIndex++)
dlg.m_cList.AddString(lpszNames[nIndex]);
ERROR
dlg.DoModal();
I'm overlooking something, but what?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Sorry, but something's going wrong here
nIndex is a loop from 0 to nMax containing 1 functioncall
dlg.m_cList.AddString(lpszNames[nIndex]);
It's the functioncall that causes the error
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
frisco wrote:
It's the functioncall that causes the error
Yes! Read my reply to your first post!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
That last post was ment as a correction on the first post. something went wrong with the formatting: lots of characters are lost...
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
frisco wrote:
I'm overlooking something, but what?
Your dialog is not created yet! The C++ object is created, but the actual window it wraps is not up! That's why you get the assert. Use DoModal() and then put your list populating code in the OnInitDialog() handler
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Sorry, but I'm still in the "java" kind of programming
So, the instantiation is only made when the dialog is show on screen, and not when we call the constructor (like in java)? Am I having this wright?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
frisco wrote:
So, the instantiation is only made when the dialog is show on screen, and not when we call the constructor (like in java)? Am I having this wright?
The object [Here a CDialog derived class] is instantiated alright. But the underlying window is not yet created. MFC classes are really thin wrappers over the API. Till Create or DoModal is called, you should not try making any window manipulating function calls! Or any calls that access child controls in the window.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I have a function that takes the pidl of a folder and loops through all the files in the folder and if there is a folder i the folder it calls itself, else it adds the file to a listview control. This works ok the first time the function is run, but when i calls itself, the pBrowse->EnumObjects doesen't return NOERROR it returns -2147023673, can anyone help me? the pidl i pass in the function is a pidl gotten from the SHBrowseForFolder function, here is the function:
(ignore the text after the pre tag, something went wrong when i modfied the post.
void AddFilesFromFolder(ITEMIDLIST *pIdl)
{
if (pIdl)
{
IShellFolder *pBrowse = NULL;
LPENUMIDLIST pFolder = NULL;
LPMALLOC pMalloc = NULL;
ITEMIDLIST *pNewId = NULL;
STRRET strDispName;
LVITEM lvItem;
RECT rMain;
RECT rAdd;
char szCurrentFile[MAX_PATH+1+5];
char szFolderPath[MAX_PATH+1];
DWORD pActual = 0;
DWORD dwAttrib;
IShellFolder *CurrentFolder;
HRESULT err;
err = SHGetDesktopFolder (&CurrentFolder);
if (err == NOERROR)
{
SHGetMalloc(&pMalloc);
CurrentFolder->BindToObject(pIdl, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);
pBrowse->GetDisplayNameOf(pIdl, SHGDN_INFOLDER, &strDispName);
err = pBrowse->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder);
if (err == NOERROR)
{
SHGetPathFromIDList(pIdl, szFolderPath);
lvItem.mask = LVIF_IMAGE | LVIF_TEXT;
while (pFolder->Next(1, &pNewId, &pActual) != S_FALSE)
{
dwAttrib = SFGAO_FOLDER;
pBrowse->GetAttributesOf(1, (LPCITEMIDLIST*)&pNewId, &dwAttrib);
if (!(dwAttrib & SFGAO_FOLDER))
{
pBrowse->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
PathCombine(gszPath, szFolderPath, strDispName.cStr);
GetID3();
FillInfo();
ListAddItem();
}
if (dwAttrib & SFGAO_FOLDER)
{
pBrowse->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
AddFilesFromFolder(pNewId);
}
}
pMalloc->Free(pNewId);
pMalloc->Release();
EndDialog(hDialog, true);
gbFileOpen = true;
pFolder->Release();
}
CurrentFolder->Release();
}
}
} etDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
AddFilesFromFolder(pNewId);
}
}
pMalloc->Free(pNewId);
pMalloc->Release();
EndDialog(hDialog, true);
gbFileOpen = true;
pFolder->Release();
}
CurrentFolder->Release();
}
}
}
|
|
|
|
|
redeemer wrote:
Ignore this post something's wrong with it, i'll make another.
LOL
Okay! HTML does weird things I guess
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Yep, something's going wrong here
same for two messages above this: CFileDialog assertion error
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
You can also modify or delete a post if you are not satisfied with it.
Best regards,
Alexandru Savescu
|
|
|
|
|
i want to know where can registry free homepage account!
i need a free web space (3-10MB)
please introduce me some.... thank you.
|
|
|
|
|
You can find hundreds of free web services, did you look at google.com directory ?
|
|
|
|