|
I have used the IconPro sample program that comes on the MSDN CD
\Samples\VC98\SDK\WINUI\RESOURCE\ICONPRO
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
Well, for the first time (kinda funny really considering the number of MFC projects I've worked on) I have to support help in my application. The application is dialog based. Being new to actually supporting help, when I set up the project I turned on the "Context Sensitive Help" flag when setting up the initial project in Visual C++ 6.0. That gives me the Help button and adds a Help files folder to my Workspace window. When I build it builds a generic (empty) help file for me. Well, I have a technical writer available for this project (who likes Robohelp) so I figured all she'd have to do is give me a help file that I would copy over the default one DevStudio builds for me. I figured all I'd need was the .hlp and .cnt files.
Well, that doesn't work. When I click help all I get is "That topic does not exist. Contact your application vendor.....". If I double-click on the help file outside of the project it comes up just fine. Could someone guide me on the correct steps for merging in this RoboHelp help file into my project?
Thanks,
Matt Philmon
|
|
|
|
|
Hi,
This post is a little lengthy, but I'm hoping that someone out there
will take pity on a former VC++ developer who has been forced into VB
development for the past two years and who would like to move back to
VC++.
I have a project that is in need of a re-write. Now would be the
perfect time to switch from VB COM development to VC++ COM
development. I have a team of people who are in favor of the switch,
but their experience with C++ is not extensive.
In an attempt to make the switch I have sought out these past two
weeks all information I could find on developing ATL components for
COM+. My application is a web site, so the components will be
accessed from ASP pages and the COM components will access a SQL
Server 2000 database.
I have encountered many hurdles. The first of which is that most
tutorials assume that the reader wants to know EVERYTHING about ATL
development. I can't afford for my people to get lost in the myriad
of details. My components do not do much. They receive requests from
ASP pages, access the database, massage data going in or going out and
then pass back results to the ASP pages. Not rocket science. So, I
do not need (initially anyway) to approach issues like aggregation or
containment (except as they apply to object pooling). Second, it is
very hard to locate information on directly needs to be done to ATL
components to allow them to take best advantage of COM+. I know that
there ARE such issues because I stumbled across an MSDN article that
mentioned several issues such as how I must remove the
NON_AGGREGATABLE #define from an object created from the MTS Object
wizard option. Finally, I approached data access this weekend and was
startled to understand that OLEDB is the preferred access method over
ADO. That's all well and good, and I see hoe the wizards made using
OLEDB a snap. However, I have yet to see an example that shows me how
to use OLEDB to execute a stored procedure (I wrap my database in
stored procedures and require that all access go through them). Also,
in VB I had a COM object that represented each table in the database,
but each of these COM objects accessed a single 'accessor' object for
its database access. The OLEDB model (at least the ATL wizard anyway)
sets up a model in which each of my 'table' COM objects would access
the database directly. Is this a standard with OLEDB/ATL? Even if I
use OLEDB and create OLEDB consumers, I currently pass ADO recordsets
around and eventually I pass them to the ASP pages. How is this done
with OLEDB? Do you use a mixture of ADO and OLEDB?
I very much want to make the switch to VC++, but I can't chance a
severe delay in our project schedule. As the most experienced VC++
developer on our team, I have set my understanding of what we need to
do as the baseline for this decision. If I can't figure it out in
short order, then we'll have to stick with VB.
The purpose for this post is to humbly ask for assistance. I'm not
looking for the answers (although I'll take them if you have them),
but rather I am looking for some pointers to resources that you think
might be best for my situation. I have a very short time in which to
make this decision (I would say at most, two more weeks). I do NOT
have to understand everything in the next two weeks, but I need to
feel that I have a handle on everything and that the project is doable
within my time line.
I have a number of books I have consulted:
Beginning ATL 3 COM Programming
Professional ATL 3 COM Programming
Beginning ASP Components
Professional ASP 3.0
Don Box's COM book (I have it, but it's not a great resource at this
stage of my understanding)
I have on order:
Creating Lightweight components with ATL
The Standard Template Library from Scratch (I understand that I will
be using STL a lot in my ATL development - I'm a former MFC coder, so
no familiarity with STL)
Designing Solutions for COM+
My biggest questions of all center on the database access and OLEDB.
I thank you for your time and I thank you in advance for any
assistance you can provide.
Neil Kiser
neil@interaccess.com
|
|
|
|
|
<<< In the name of GOD >>>
Hi all.
My program is Dialog based mode.
I want set font and color for printer.
I use SelectObject but ...
Please example about it.
Thanks.
Hadi Rezaie
|
|
|
|
|
CDC dcPrinter;
CFont* m_pFntCaption = new CFont;
ASSERT(m_pFntCaption);
m_pFntCaption->CreateFont(-80, 0, 0, 0, FW_NORMAL, TRUE, FALSE, 0, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_MODERN, "Courier New" );
CFont* pFont = dcPrinter.SelectObject(m_pFntCaption);
ASSERT(pFont);
-80 is the font size -> (4 * -20)--> therefore this is font size 4 (but not same as those MS WORD ..... it's just a number for reference). You can find more info in Help....and search for CreateFont.....
Hope can help
|
|
|
|
|
Please look my program:
CFont *pFont; // It's member variable
.
.
.
In initdialog event:
pFont->CreateFont(...);
Now, in print dialog:
CDC dc;
CPrintDialog Prn(FALSE);
.
.
.
dc.Attach(PrnDlg.GetPrinterDC());
dc.SelectObject(pFont); // BUT WON'T WORK
.
.
.
So, what is my mistake.
ATTENTION: I NEED TO YOUR ANSWER VERY FAST ...
Hadi Rezaie
|
|
|
|
|
I don't know.....maybe you have to get the printer first, then do the font....or.....
but I do everything in one procedure and just call this procedure and print....:
/*
** get the default printer
*/
CPrintDialog dlg(FALSE);
dlg.GetDefaults();
// Get a handle to the printer device context (DC).
HDC hdcPrinter = dlg.GetPrinterDC();
/*
** create a CDC and attach it to the default printer
*/
CDC dcPrinter;
dcPrinter.Attach(hdcPrinter);
//print as landscape
LPDEVMODE pDevMode;
pDevMode = dlg.GetDevMode();
pDevMode->dmOrientation = DMORIENT_LANDSCAPE;
dcPrinter.ResetDC(pDevMode);
// call StartDoc() to begin printing <=======================did you do this part?
DOCINFO docinfo;
memset(&docinfo, 0, sizeof(docinfo));
docinfo.cbSize = sizeof(docinfo);
docinfo.lpszDocName = _T("CDC::StartDoc() Code Fragment");
// if it fails, complain and exit gracefully
if (dcPrinter.StartDoc(&docinfo) < 0)
{
AfxMessageBox("Printer wouldn't initalize");
}
else
{
//start a page
if (dcPrinter.StartPage() < 0)
{
AfxMessageBox("Could not start page");
dcPrinter.AbortDoc();
}
else
{
// Print everything on the screen
CGdiObject* pOldFont = dcPrinter.SelectStockObject(SYSTEM_FONT);
/*
** print caption
*/
//set the font first - Courier New
CFont* m_pFntCaption = new CFont;
ASSERT(m_pFntCaption);
m_pFntCaption->CreateFont(...);
CFont* pFont = dcPrinter.SelectObject(m_pFntCaption);
ASSERT(pFont);
// Print some text...just liked OnDraw
dcPrinter.TextOut(0, 0, CaptionString);
//finished <=======================did you do this part?
dcPrinter.EndPage();
dcPrinter.EndDoc();
dcPrinter.SelectObject(pOldFont);
delete m_pFntCaption; //delete the font
I think you might miss out the StartPage and EndPage...etc....It is exactly what i did in printing...everything in a procedure only...that's it...
|
|
|
|
|
Sorry, may be i made it unclear - i'm not trying to print. I'm trying to
monitor the printer.
|
|
|
|
|
Hi,
Does anyone know how to do the following things when launching the MFC program?
First, start with a Dialog with no title bar, no menu, no button....nothing.....just a picture on it.
Second, hold this dialog for awhile.....let say 5 seconds.
Third, close automatically.
Finally, start the MFC program.
I know how to pop the dialog (DoModal()) and how to wait for 5 seconds...but i don't know how to close the dialog, and how to do it before the program start.
It just likes Internet Explorer...when we launch IE, then it pop a little box...."Internet Explorer 5.0...." then start IE...right?
Thanks.
|
|
|
|
|
EndDialog(IDOK)www.marbus.net
But then again, I could be wrong.
|
|
|
|
|
EndDialog(IDOK)www.marbus.net
But then again, I could be wrong.
|
|
|
|
|
Still don't know how to do...because when i use DoModal() to pop up the dialog, it waits for the user to click "OK or...." but now i won't use button in here and want to use code to make it close.......now my code is:
CxxxDlg xxdlg;
xxdlg.DoModal();
xxxx //make 10 seconds wait...
xxdlg.EndDialog(IDOK);
seems doesn't work....how to fix it?
|
|
|
|
|
Just put up a timer
SetTimer(1, 7000, NULL);
and when WM_TIMER (after 7sec) is called by the framework, just set your
void MyDialog::OnTimer(UINT nIDEvent)<br> {<br> if(nIDEvent == 1)<br> {<br> KillTimer(1);<br> MyDlg.EndDialog(IDOK);<br> }<br> }
I guess, that's what you wanted to know...
Manfred
---
Programming is knowing...
|
|
|
|
|
Do the following:
CYourApp::InitInstance()
{
.
.
.
// Call your first dialog
FirstDialog::DoModal();
// Call your main dialog
MainDialog::DoModal();
.
.
.
}
CFirstDialog::OnInitInstance()
{
// Do initialization stuff
// Set timer
SetTimer(1, 10000, NULL);
return TRUE;
}
CFirstDialog::OnTimer(UINT nIDEvent)
{
if(nIDEvent == 1)
{
KillTimer(1);
EndDialog(IDOK);
}
}
This should display your splash screen for ten seconds before it loads the main dialog.
|
|
|
|
|
as alex said ... what you are describing is a splash screen
pj has a good implementation on this site somewhere
go check it out
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
How do I pass a string array to a dll to be used and modified
then be able to use that modified array from the calling program
I've try to the pass a variant array to the dll, the export function is a so;
long _stdcall GetList(LPSTR pszName, VARIANT FAR* vNumbers)
vNumbers is passed in by a VB app as first declared as a variant then as a string
I can read the array that I passed in, modify it and read the modification that were made.
after the function is done and I'm back in the calling program (mine is VB)
the function I passed in emtpy, (VB say that the array is out of memory)
(although if I put the array in a messagebox it can be read...I don't know why)
Now, I know that VB handles BSTR differently If a DLL procedure expects an LPSTR (a pointer to a null-terminated string) as an argument, pass the BSTR by value. Because a pointer to a BSTR is a pointer to the first data byte of a null-terminated string, it looks like an LPSTR to the DLL procedure.
Is there another way to pass a array of string to a dll ?
thanks
|
|
|
|
|
Hi,
I've got a problem here (but then again, don't we all?). The situation is as such:
We have developped a very large application which can create very large vector based images. In building it, we never thought about printing over multiple pages, because our customers have extremely large printers and plotters, so that paper size would not be a problem...
Now we want to exploit the program to home users who do not have plotters at home and do want to print the images in true scale. This CAN be done by printing over multiple pages, but then again, the program wasn't build to do this and re-aranging the comlete code will take weeks and could even take months...
So my question actually is:
'Is there a possibility to print over multiple pages, without having to alter the drawing code itsself. Are there, for example, possibilities to let the Device Context class devide the image in A4-parts??'
I hope someone can help me at least a bit. Right now every input is welcome!
|
|
|
|
|
I've been working on adding a system tray icon into my program. The icon is created fine, the icon's popup menu works as well, but I can't figure out one thing. When the program is minimized, I want it to disappear off the Windows taskbar, so you can only restore it via the tray icon (the way a program like ICQ works). I can't seem to figure out how to make the program remove itself from the taskbar, though...could anyone point me to some information on that? Thanks a lot.
|
|
|
|
|
Hi,
I asked for a solution to open Access2000 mdb file from VC6 since VC 6 was not able to open the latest version of Access db. Peter Zajac gave me the solution, to include this line of code:
AfxGetModuleState()->m_dwVersion = 0x0601;
It works. But to find more info, I tried MSDN. But, to my surprise, there isnt any documentation available for this API.
In addition, MSDN mentions AFX_MODULE_STATE but there is no detail about this structure either. How can I find the information about these?
Also m_dwVersion is the version of what?
Ammar
|
|
|
|
|
Continuing on with my insignificant do nothing dialog application that implements many controls just for the sake of seeing how they work.
I have added a Progress Control that starts filling when the Start button is clicked, at the same time the button label changes to Stop. As you may have guessed I want the Progress Control to go up and down until such times as the Stop button is clicked. Can't figure out how to do this, initial thought is to use a thread to run the Progress Control and stop the thread when the Stop button is clicked. After reading Using User-Interface Threads by Joseph M Newcomer I am none the wiser, if the answer is in any of my Win32 and MFC programing books I can't find it.
Anyone have an answer for me.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
G'day Michael,
You could create a timer for the dialog window when the 'Start' button is clicked, then add a WM_TIMER handler to update the progress control on WM_TIMER events, and then kill the timer then the 'Stop' button is clicked.
Check out the CWnd::SetTimer() and CWnd::KillTimer() functions in the docs.
HTH,
Steve
|
|
|
|
|
Hi,
In Visual C++, if you create a file using CFile, is there any way to tell whether this file is a file or a folder? In Java, you can use "isDirectory()" to do this. Is there a
similar way in Visual C++? Thanks. Or is there any other way to create a file? Any suggestion or comment is appreciated.
Also, when using CFileDialog, all the folders and files will be displayed for you to select. Is there any way to only allow folders to show up? Thanks.
|
|
|
|
|
Try CFileFind::IsDirectory
By the way, Doesn't CFile always create a file?
I have never tried creating a folder. Can CFile do that?
Ammar
|
|
|
|
|
Sorry if I asked not good question. I am relatively new to Visual C++.
I tried the CfileFind class. It seems that this the right one. But I still have some problems. The following is the code I tried. It works ok to find the specific file or directory. But when I tried to test whether this is a directory or not, it gives an "assertion failure". I have no idea how it happenes. Can you tell me what went wrong? Also, if possible, can you give me a little example (several lines) of how this may work? Thanks a lot.
CFileFind finder;
BOOL bWorking = finder.FindFile(filename);
if(bWorking) {
if(finder.IsDirectory()) {
...............
|
|
|
|
|
Also, when using CFileDialog, all the folders and files will be displayed for you to select. Is there any way to only allow folders to show up?
CFileDialog is not meant to do this. The folder-selection dialog is done with the SHBrowseForFolder() API.
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|