|
Is it possibl to initiate a graphics mode in a standard C++ console application? If it is and you have before, i would praise you if you took a moment to copy\paste the source in a response to this message. I have Visual C++ 6.0 Standard Edition.
|
|
|
|
|
No, you can't initate graphics mode in a console application (which is what 32 bit VC creates). You can do so in a DOS application, but you would need a DOS targeting compiler.
You'll need to use standard Windows GDI, WinG, or DirectX.
|
|
|
|
|
Its been a while since I've used it, but I remember Allegro was a pretty good graphics library.
|
|
|
|
|
I have a function that keeps returning a value. For some reason, when I have at the end of that function
cout << "." << endl;
everything works, I get a new value each time. If I leave this command off or type cout << "."; I get an error in my calculations.
Several sources say "the endl command outputs a newline character and flush the stream". How can I "flush the stream" without creating a new line?
Any response any one can give me will be greatly appreciated.
Sincerely,
Erich J. Ruth
|
|
|
|
|
|
I really appreciate your response. I have gotten responses
from you before and they have always been helpful.
For some reason, I still can't get my code to work. I managed
to reduce it to the following error. If I type at the end
of my function
cout << "." << endl;
the code works fine, but I get along list of periods before
I get the answer. If I type
cout << ".";
or
cout << "." << "\n";
or
puts("");
or anything that doesn't have the endl command, then my
calculations are way, way, way off. It does not make any
sense to me why is works with endl. In a book I read,
it says endl "flushes the stream", but the command
cout.flush(): doesn't "flush" anything.
I am going nuts! Please any response you can give me will
be gretly appreciated.
Sincerely,
Erich J. Ruth (an overworked graduate student)
|
|
|
|
|
Let me go back one step and ask, do you know what flushing means? Standard output is normally line-buffered, so that any text sent to cout is not printed until an end-of-line character ('\n') is printed, or the program exits.
Flushing cout means that any text waiting to be printed is immediately printed.
Since the endl manipulator does an "end of line", it flushes cout . Calling cout.flush() does the same thing, just without going to a new line.
If the presence/absence of a cout method call is affecting code earlier in the function, I'd guess that you have a stack or buffer overrun somewhere in your code.
How exactly is your code going wrong when you don't have cout << endl; ?
--Mike--
http://home.inreach.com/mdunn/
|
|
|
|
|
> How exactly is your code going wrong when you don't have > cout << endl;?
If I leave the endl, I get no real errors, the computer doesn't crash or anything, I just get the wrong calculations, almost like it forgets or confuses simple addition.
If I insert endl, I get no errors and my calculations are dead-on.
I have a vague clue as to what flushing is.
I am stuck badly. Any other response, suggestions, anything will be greatly appreciated.
Sincerely,
Erich J. Ruth
|
|
|
|
|
You might try showing us how you are doing your calculations with some code. Showing us only the line withou cout doesn't help us figure out how you calculations can be mysteriously "wrong".
Try to isolate it to as small of a section of code as you possibly can.
|
|
|
|
|
Hi,
Here is a function (above) to browse Computers names on network.
It work but I have a problem to get the name of machine which is selected.
If i use this call :
CString strDir = BrowseForFolder(m_hWnd, "Select a folder", 0 );
with browseInfo.pidlRoot=NULL;
I obtain the name of folder selected.
BUT WITH THIS CALL
CString strDir = BrowseForFolder(m_hWnd, "selected a computer", BIF_BROWSEFORCOMPUTER );
with browseInfo.pidlRoot=(_ITEMIDLIST *)0x12;
The function browse very match only computer but my variable strDir is empty at the end.
I try to use this other function :
SHGetSpecialFolderPath(hWnd,szBuffer,CSIDL_NETHOOD ,0);
but i have a entry point problem to shell32.dll
Can anybody help me to get computer name?
Function
================================================================================
CString& CTestDlg::BrowseForFolder(HWND hWnd, LPCSTR lpszTitle, UINT nFlags)
{
static CString strResult = "";
LPMALLOC lpMalloc; // pointer to IMalloc
if (::SHGetMalloc(&lpMalloc) != NOERROR)
return strResult; // failed to get allocator
char szDisplayName[_MAX_PATH];
char szBuffer[_MAX_PATH];
BROWSEINFO browseInfo;
browseInfo.hwndOwner = hWnd;
// set root at Network Neighborhood ( if NULL then set root at Desktop )
browseInfo.pidlRoot = (_ITEMIDLIST *)0x12;
browseInfo.pszDisplayName = szDisplayName;
browseInfo.lpszTitle = lpszTitle;
browseInfo.ulFlags = nFlags;
browseInfo.lpfn = NULL; // not used
browseInfo.lParam = 0; // not used
LPITEMIDLIST lpItemIDList;
if ((lpItemIDList = ::SHBrowseForFolder(&browseInfo))
!= NULL)
{
// Get the path of the selected folder from the
// item ID list.
if (::SHGetPathFromIDList(lpItemIDList, szBuffer))
{
// At this point, szBuffer contains the path
// the user chose.
if (szBuffer[0] == '\0')
{
// SHGetPathFromIDList failed, or
// SHBrowseForFolder failed.
//AfxMessageBox(IDP_FAILED_GET_DIRECTORY,MB_ICONSTOP|MB_OK);
return strResult;
}
// We have a path in szBuffer!
// Return it.
strResult = szBuffer;
return strResult;
}
else
{
// The thing referred to by lpItemIDList
// might not have been a file system object.
// For whatever reason, SHGetPathFromIDList
// didn't work!
//AfxMessageBox(IDP_FAILED_GET_DIRECTORY,MB_ICONSTOP|MB_OK);
return strResult; // strResult is empty
}
lpMalloc->Free(lpItemIDList);
lpMalloc->Release();
}
// If we made it this far, SHBrowseForFolder failed.
return strResult;
}
|
|
|
|
|
I have a SDI application with a splitter: treeview on left and dialog in a formview on right. Every time I open a file, the window resizes to the default size (and only if it was bigger than the default size). What is causing that and how can I solve it.
Thanks
(Sorry if my English is not perfect: French dude)
|
|
|
|
|
i need to do a couple of things with TCL in a component of C++.
does anybody knows how can i do that????
i got the TCL script and the code of the component, but i need to run a script of TCL in the component.
Thanks!!!!!
|
|
|
|
|
I'm currently writing a Client Server Type application. In my experience in the past with DCOM its performance, even when optimized for DCOM, hasn't been that great and its reliablity in a WAN environment has been nothing to write home about. Unfortunatly for various reasons MTS isn't an option for me at this point. I have messed with Sockets in VB but not in VC++. Is it worth my time to investigate using sockets as apposed to DCOM especially since it appears that Microsoft is moving away from DCOM in favor of its .Net initiatives(SOAP & XML). In your experiences am I going in the wrong direction thinking of sockets. Am I just really far off in my thoughts here. Any advice would be appreciated. Thanks in advance.
|
|
|
|
|
I have two classes in a DLL. One class CStringDialog is for a dialog box. The other class CCaller contains one function DisplayDialog which calls the dialog using the DoModal function.
When I call the DisplayDialog function from another executable, the application get to the function, but does not display the dialog.
Any suggestions would be appretiated.
|
|
|
|
|
The code is probably looking in your application's resources for the dialog box resources. Try something like the following:
HINSTANCE h = (HINSTANCE)::GetModuleHandle("YourDLLName");
ASSERT(h);
HINSTANCE hPrevious = AfxGetResourceHandle();
AfxSetResourceHandle(h);
dlg.DoModal();
AfxSetResourceHandle (hPrevious);
|
|
|
|
|
I need to set the default file open folder for open file in a doc/view/mdi app. I know about the win32 api structure containing an initial folder parameter. The file is serialized.
Do I have to completely subclass the dialog or is there a way to modify that structure variable capturing the menu message on File Open and then pass to the standard CFileOpen without rewriting all of it?
Also, what module (MainFrame, ChildFrame, etc, do I capture the message and set the initial folder variable, then pass on to the standard function?
I do not want to start in My Documents but will load the default path from a parameter I've stored successfully in the registry.
This is a multi-template app depending on file extension, but for now all the files will be stored in one default folder. Nothing to set in the menu resource string tables for this?
|
|
|
|
|
|
but can I catch this in the framework without subclassing the entire file open?
In the doc On Open? elsewhere in the wiz generated doc/view?
|
|
|
|
|
Hi,
You can do it by changing the members of your CFileDialog before calling DoModal() :
CFileDialog(TRUE, .......);
dlg.m_ofn = ...
if (dlg.DoModal() == IDOK)
{
// Do Open thing here
}
Hope this helps,
Berkut
|
|
|
|
|
Hi,
I work in Visual C++ 6.0 and i want to get all computer names on a network
How can i get (enumerate) theses machines names?. Is there network browsing dialogs in C++ std or MFC ?
Thanks in advance
|
|
|
|
|
There is a sample under the tree controls on this site that enumerates the network. If you get it to be able to also browse target machines, and files, please let me know.
I got close, but not close enough.
|
|
|
|
|
Hi
I am using GetDeviceCaps(BITSPIXEL) to retrieve color bits for each pixel. If GetDeviceCaps(BITSPIXEL) returns 16 bits per pixel, does anyone know how to figure out if this 16 bpp is in 565, 1555 or 556 formats?
Thanks for any replies!
Kim
|
|
|
|
|
Hi.
I'm trying to learn how to make .inf setup files for a cab. Does anybody know of a good tutorial i can read. The MSDN is not much help. I'm trying to add keys to the registry, but they do not get added..
Chris
|
|
|
|
|
Hi Chris,
Why not u use Installshield for making the setup program. It is easy and u can have Licence Serial Number for ur product also.
Let me know,is helpful to u ?
Manish
|
|
|
|
|
Hi.
I'm trying to learn how to make .inf setup files for a cab. Does anybody know of a good tutorial i can read. The MSDN is not much help. I'm trying to add keys to the registry, but they do not get added..
Chris
|
|
|
|