|
Ive looked through here and the general concensus is that it is not possible to have an application with a msg loop but no window.
On the contrary, it is perfectly possible to have an app with a message loop and no windows at all. The following is an example including a Windows timer that terminates the app in 5 seconds:
#include <windows.h>
static UINT ending_timer=0;
static VOID CALLBACK ending_timer_proc(HWND,UINT,UINT,DWORD)
{
PostQuitMessage(0);
}
int main(void)
{
MSG msg;
PeekMessage(&msg,NULL,0,0,PM_NOREMOVE);
ending_timer=SetTimer(0,0,5000,(TIMERPROC)ending_timer_proc);
while(GetMessage(&msg,NULL,0,0)!=0){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
KillTimer(0,ending_timer);
return 0;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi.
Is there a way to disable the auto status bar update on pane 1? For example, you will see "Ready" in the first pane of the status bar when the program first starts (single-document using AppWizard). I need to use pane 1 of the status bar for something. I would like to disable the auto status bar update (system update).
Thanks,
Kuphryn
|
|
|
|
|
Hi.
I am using AppWizard single-document type setup. I need to get the rectange of the ChildView. All I am trying to do is change the background color of the ChildView. So ineed to get the exact size and location of the ChildView related to the MainFrame. I tried using this:
-----
CWnd *pWnd = AfxGetMainWnd();
CRect rectCView;
pWnd->get(rectCView);
CBrush *pOldBrush, newBrush(RGB(0, 0, 0));
CDC *pDC = pWnd->GetDC();
pOldBrush = pDC->SelectObject(&newBrush);
pDC->Rectangle(rectCView);
pDC->SelectObject(pOldBrush);
pWnd->ReleaseDC(pDC);
-----
The problem with the code segment above is that it repaint everything inside the MainFrame including the toolbar and statusbar. I would like it to paint the ChildView.
Thanks,
Kuphryn
|
|
|
|
|
Paint it inside the Child View.
That would be much easier and correct,
ensuring repainting of the child view
will retain the bkcolor.
|
|
|
|
|
|
Hi All,
I have a device I need to communicate with using TFTP (not to be confused with FTP). There is a windows NT command line program that works with it but I was wondering if there are any Functions or API's available to use in C++ that anyone knows about??
Otherwise would it be reasonable just to run the tftp.exe program from my C++ application? I think using CreateProcess or WinExec should work for this but I'm not too sure how yet
Thanks for any advice you may have
-Mark
|
|
|
|
|
Trivial FTP is a pretty simple protocol. You could implement it yourself. Find the correct RFC for it's specification.
Also, probably not relevant, but Cisco have a whole bunch of TFTP tools(their routers flash via TFTP)
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Is there a simple way to use ONE dialog for a dialog-based application, yet still be able to maintain each screen separately in the dialog editor? It seems most wizards use a single dialog-- yet creating nice looking dialogs from scratch (i.e. without the dialog editor) is a complete pain.
An example of a wizard that appears to use one dialog in its wizard is Winzip. I believe InstallShield has a similar appearance.
Right now I am creating separate classes for each dialog; calling EndDialog() when the user presses NEXT, and then creating the next dialog. This does not appear to be standard, and sticks out like a sore thumb.
Any help would be appreciated.
- Rob
|
|
|
|
|
If you're using MFC, you might want to have a look at CPropertySheet and SetWizardMode. Basically you can maintain your dialog templates separately, and create a CPropertyPage-derived class for each one. Then you simply add each Page to your Sheet, SetWizardMode, and away you go. Much easier than rolling your own, methinks...
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
how come when i try to use SHGetFileInfo (code below) to get the small icon of an HTML file, it instead returns the small icon of a file with the little windows icon in it, as if there was no file association for .HTML files?
i'm using Win2K and IE6 (doesnt work on IE5) either
NOTE: this happens sparadically (did i spell that right?), sometimes it works and sometimes it doesn't, it seems awfully random...
NOTE 2: i tried 2 ways, both are shown below:
method 1:
SHFILEINFO fInfo; memset(&fInfo,0,sizeof(fInfo));
SHGetFileInfo("C:\\somefile.html",0,&fInfo,sizeof(SHFILEINFO),SHGFI_ICON | SHGFI_SMALLICON);
return fInfo.hIcon;
method 2:
SHFILEINFO fInfo; memset(&fInfo,0,sizeof(fInfo));
HIMAGELIST hImages = (HIMAGELIST)SHGetFileInfo("C:\\somefile.html",0,&fInfo,sizeof(fInfo),SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
return ImageList_GetIcon(hImages,fInfo.iIcon,ILD_TRANSPARENT);
-Roman
|
|
|
|
|
Some times the SysIconIndex does behave like that.
Try rebooting the machine and check once again.
|
|
|
|
|
the problem is, this happens consistently on several computers i have (and i do keep my computers tidy)
so i think it's some problem w/ win2k or something w/ my code... MS's InterDev seems to show the HTML icon perfectly... its gotta be something w/ my methods
-Roman
|
|
|
|
|
ok, it seems CoInitialize() and CoUninitialize() weren't being called... it works now hehe
final snippet:
HICON GetIconForFile(CString strPath, BOOL bLargeIcon)
{
CoInitialize(NULL);
SHFILEINFO fInfo; memset(&fInfo,0,sizeof(fInfo));
SHGetFileInfo(strPath,0,&fInfo,sizeof(SHFILEINFO),
SHGFI_ICON | (bLargeIcon ? SHGFI_LARGEICON : SHGFI_SMALLICON));
CoUninitialize();
return fInfo.hIcon;
}
-Roman
|
|
|
|
|
RomanNY wrote:
CoInitialize(NULL); SHFILEINFO fInfo; memset(&fInfo,0,sizeof(fInfo)); SHGetFileInfo(strPath,0,&fInfo,sizeof(SHFILEINFO), SHGFI_ICON | (bLargeIcon ? SHGFI_LARGEICON : SHGFI_SMALLICON)); CoUninitialize(); return fInfo.hIcon; // must be eventually destroyed by calling function
probably using the CoInitialize & CoUninitialize in the App Class is
a much better approach.
|
|
|
|
|
good point. ah screw it who needs efficiency anyway? thanks for the comment, you're 100% right
-Roman
|
|
|
|
|
Ok,... I want to program a Game Engine, "Take note that this engine is not going to be a 3D Game Engine yet a 2D engine" I want this engine in a Windows format. I want to have a grid of squars, and a toolbar full of pictures for i can place the pictures on the squars to make an Role Playing Game map.
What is the bast way of starting this project? Should i study in MFC? or program in a windows format from win32 application?
Thanks for your help, and opinions!
~SilverShalkin
When the programming gets tuff
The programmer gets tuffer?
Or falls behind and becomes
brain dead i suppose
|
|
|
|
|
I think you should program with whatever frame work that you are most comfortable with, because after all, what your are programming is a GUI, not really the game yet. And even when you do program your game, it will not require the same type of processing power as a first-person shooter.
I would definitely look at MFC or WTL because they offer nice support for toolbars and treeview and the other types of windows that you will probably use. These things can be very tedious with raw Win32 SDK programming.
|
|
|
|
|
That is exactly what i wanted to know, thankyou! also one more question...
kilowatt wrote:
I would definitely look at MFC or WTL
what is WTL? I know what MFC is... And what one of these would be best to learn?
Thanks again
~SilverShalkin
I say read on and dont
let the mountains of info
confuse you!
|
|
|
|
|
WTL is the Windows Template Library. It is an extension to ATL. WTL is a set of wrappers around most of the Win32 API functions that are used for windowing. WTL is very lightweight, and it is designed with the same template paradigm that ATL is.
The main drawback with WTL is that there is no official documentation from Microsoft, so in order to use and learn it you will need to use any examples that you can find on the internet. There is a good two part series at www.sellsbrothers.com. In order to get WTL you will need to goto Microsoft.com to download it.
I prefer WTL, because it is closer to the operating system, and you can pick and choose the pieces that you want to use. However with MFC, there are plenty of books, documentation, and it has a lot more features.
Good Luck
|
|
|
|
|
WTL is GOD!!!
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Which one of these are better, "by opinion" for programming a 2D RPG game?
Thanks
~SilverShalkin
|
|
|
|
|
That is really hard to say.
IMHO, WTL has less baggage. After all, I doubt you will need MFC's document stuff.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Ok,... i was going to do everything in MFC, but because of Tim Smith's view of WTL which is, if you didnt see "WTL IS GOD! " and this recent file from Kilowatt, where it says that MFC has allot of documentation that i wouldnt really need... I think im going to give WTL a try
Ill be asking questions soon, i warn thee
While im here, WTL has similer coding to win32app?
Thanks for your help!
~SilverShalkin
Clear skies are better to look at
then stormy ones
|
|
|
|
|
No, if anything, WTL looks similar to ATL because it's a template library, I *believe* based on the windowing support in ATL. However, just like MFC, it doesn't hide/remove any Win32 stuff, so anything you can't do in WTL you can do in Win32. Given the nature of your app, I didn't respond but expected DirectX under Win32 to be the clear winner. I don't see what MFC or WTL will bring to the party when you'll be basically just wanting a window to draw your own stuff in.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
I believe what he is developing at this point is the development tool that will help him design the maps and levels. That is why he is concerned with which tool to use for windowing support.
|
|
|
|
|