|
Hello everyone,
I want to use the CArray template class, but I am having difficulty getting it loaded. What I mean is that when I load the header file that defines it, "afxtempl.h", I get the following error:
[code]
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18):
fatal error C1189: #error : WINDOWS.H already included.
MFC apps must not #include <windows.h>
[/code]
I'm kind of stuck as to what to do. I noticed that code posted online seems to include "stdafx.h" instead of "afxtempl.h". I think this file is a generated file, but I'm not sure how to go about generating it.
This is my first post, so please let me know if I need to include additional information.
Thanks,
-Jash
|
|
|
|
|
When you load MFC, it will initialize the windows.h for you. Loading windows.h again will cause redundancy.
It a better practice of placing your MFC headers in your stdafx.h along with other MFC headers like
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxtempl.h>
<B>Sonork 100.41263:Anthony_Yio
Life is about experiencing ... </B>
|
|
|
|
|
Hi,
I need to create a CHeaderCtrl that contains sub-headers.
Any suggestions would be highly appreciated.
Here is what I need:
-------------------------------
|Title1|Red_Geen_Blue|Title3|
-------------------------------
|Title1|Red|Green|Blue|Title3|
-------------------------------
|data1|Red|Green|Blue|data3|
|data2|Red|Green|Blue|data3|
|data3|Red|Green|Blue|data3|
-------------------------------
In this example, this table contains 5 columns and 3 rows.
The header of this table contains 2 rows. First row is for
the main title, second row is for the real title of each
column.
(The example of the table headers that contains multiple lines
does not help me to resolve this problem.)
Thank you in advance for your help.
Boilam
|
|
|
|
|
|
OK, this is silly.
I have Visual C++6.0 with SP6 because it's what we use at work.
I have WinXP at home, everything updates SP1 etc.
When adding a MFC derived class to a MDI project CObject doesn't appear in the list of MFC classes !
Any ideas ?
The tigress is here
|
|
|
|
|
This looks like a bug in your installation, or a missing setting.
Have you checked all directory settings of Visual Studio. It uses those directories to discover the base classes available in the wizards, I think. Or, at least I've been able to add my headers/C++ files to these directories and be able to derive from them using the wizards.
Is the CObject available for derivation in other project types ? If it is, then it's a bug in the program. My Visual Studio 2003 allows derivation from CObject without problems.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I have Visual C++.NET and that allows derivation from CObject and I have tried Visual C++6.0 on Winows 200- and that doesn't
At the moment I'm doing it manually but I'll have a look at the directory settings later.
Thanks
Elaine
The tigress is here
|
|
|
|
|
hi all,
i am working on a program that requires loading a bitmap using win32 and then allows the user to click on the bitmap and then uses the clicked points for further processing. also i need to display line segments to the clicked points from the origin.
i have been able to load the bitmap and get the points by handling the WM_LBUTTONDOWN message. but i am have been unsucessful in displaying the line segments, please provide some suggestions !!! thanks in advance
|
|
|
|
|
First Draw Bitmap then Draw line..then that will come over it...
Bitmap draw you know...
line draw as follow...
BOOL CXYZLine::Draw(CDC* pDC)
{
CPen penRuler;
if (!penRuler.CreatePen(m_nPenStyle, m_nPenWidth, m_LineColor))
return FALSE;
CPen* pOldPen = pDC->SelectObject(&penRuler);
pDC->MoveTo(m_ptStart);
pDC->LineTo(m_ptEnd);
pDC->SelectObject(pOldPen);
if(m_bSelected) DrawTracker(pDC);
return TRUE;
}
this is only I can help you...
Bye...
---Sumit Kapoor---
|
|
|
|
|
Hi,
Does anyone know how to make CFileDialog show in the image thumbnail view? Doesn't seem to be straight forward and looks like a little hackery might be required.
Thanks in advance
Rich
|
|
|
|
|
I've tried and failed See the comments at the end of this[^] article for some of the gory details.
Rob Manderson
I'm working on a version for Visual Lisp++
|
|
|
|
|
Thank for the swift response Rob, read your Article with interest. Found one code example that switches a CFileDialog into details view. Its achieved by overriding CFileDialog::OnInitDialog.
CFileDialog::OnInitDialog();
// heres the code to enable detail view
CWnd *parent = GetParent();
if ( parent != NULL ) {
parent->PostMessage(WM_COMMAND, 40964, NULL);
}
Apparently 40964 was identified using Spy, but can i as heck identify the message to switch to Thumbnail View! Any thoughts?
Thanks Again
Richard
|
|
|
|
|
Hey all.
I'm developing an application that keeps track of helpdesk information. I want to add things such as "Product Name" "Title" "Information" fields. I've developed a prototype of this application using CStdioFile and just reading/writing straight text to one file that acts as the database. I'm wondering if there is a better/faster way of doing this? Such as storing the information in a binary file or something of that nature. If anyone could point me in the right direction, it would be most appreciated. I figure that once I add a bunch of data to this, this method is going to become useless because it is going to take too long to parse through the entire file and want to know the way that the "pro's" do it. (ie, like an excel spreadsheet has all the spreadsheet data in it, but if you looked at the file in notepad, it's all jargon...)
Thanks in advance!
|
|
|
|
|
Well, you could Google for "indexed sequential access method", but why bother? Use some form of database - Access might be suitable for your purposes.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Check out http://www.codeproject.com/database/CppSQLite.asp
|
|
|
|
|
|
hi, I've a simple question, I've one main DialogBox that creates a second new one when a button is clicked, but the focus of application is passed to the new one dialog and the old one waits until it gets the quit from the other dialog, here's the code :
<br />
case IDC_MMC:<br />
if( bIsMmcDialogOpen == false)<br />
{<br />
DialogBox(hInst, MAKEINTRESOURCE(IDD_MMC), hwndMain ,DlgMMCProc);<br />
bIsMmcDialogOpen = true;<br />
EnableWindow(GetDlgItem(hWnd,IDC_MMC), false);<br />
UpdateWindow(hWnd);<br />
}<br />
break;<br />
and here it's the callback function of IDD_MMC
<br />
NT_PTR CALLBACK DlgMMCProc(HWND hWnd, UINT uMsg, <br />
WPARAM wParam, LPARAM lParam)<br />
{<br />
switch (uMsg)<br />
{<br />
case WM_CLOSE : <br />
bIsMmcDialogOpen = false;<br />
EndDialog(hWnd,1);<br />
break;<br />
}<br />
return false;<br />
<br />
}<br />
I need to get return to main Dialog immediatly, how to do it?
thanks
Paolo
|
|
|
|
|
Paolo Ponzano wrote:
I need to get return to main Dialog immediatly, how to do it?
Use a modeless dialog instead.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
can I create a modeless dialog without using MFC??? what api should I use?
|
|
|
|
|
Paolo Ponzano wrote:
can I create a modeless dialog without using MFC???
Sure.
Paolo Ponzano wrote:
what api should I use?
CreateDialog()<br />
CreateDialogIndirect()<br />
CreateDialogIndirectParam()<br />
CreateDialogParam()<br />
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
but for doing so, I need to have a class registered of the main window? at this time I've not got, since my program consists in a DialogBox itself... but those functions refers to CreateWindowEx to create the box, so I think I've to register one, tell me if I'm right
Thanks again
Paolo
|
|
|
|
|
The class, #32770, is already registered. All you need to supply is the template.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i have got a icon from other program ,now i have the HICON of the icon,but if i use LoadIcon whose parameter need icon ID,do you have a good idea?
|
|
|
|
|
In OnInitDialog() :
m_hIcon = ExtractIcon(AfxGetInstanceHandle(), path_to_file_containing_icon_here, 0);
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
how to color menu and toolbar?
|
|
|
|