|
I have multiply views and document in seperate MFC DLLs and every view has its own toolbar. When i open new document in the same view it create again the toolbars (The code of create toolbars its on the constructor of the view). How i can modify the code to not recreate the toolsbar and i have the creation and the control of the toolbars in the same DLL because different DLL loaded in different version of the program.
|
|
|
|
|
a window is resizable, but when the length of window excede 300 pixels (for example), it can NOT make larger and stop resizing. How ? Thanks in advanced
|
|
|
|
|
You could catch the WM_SIZE message and check to see if the width is greater than you want it to be and then reset it to 300.
==================
The original message was:
a window is resizable, but when the length of window excede 300 pixels (for example), it can NOT make larger and stop resizing. How ? Thanks in advanced
|
|
|
|
|
Read up on WM_GETMINMAXINFO. Windows sends this to you as the user is resizing the window. You fill in a MINMAXINFO struct with the min/max sizes, and Windows will not let the window be sized outside of those bounds.
--Mike--
==================
The original message was:
a window is resizable, but when the length of window excede 300 pixels (for example), it can NOT make larger and stop resizing. How ? Thanks in advanced
|
|
|
|
|
I've got a set of filenames: some are to files which exist, others are to files which do not exist;
some are absolute, others are relative; some are on local drives, others on network drives.
I'm looking for a way to extract the drive name from a file path, regardless of any of the above
factors.
Can anyone give me a pointer of where to look for this?
Thanx.
|
|
|
|
|
I use something like the following to get the path of an executing application:
CString sPath;
// get the path where the application is running
GetModuleFileName(AfxGetApp()->m_hInstance,
sPath.GetBuffer(_MAX_PATH+1),_MAX_PATH); //path+file
sPath.ReleaseBuffer(); // releases excess memory
sPath = sPath.Left(sPath.ReverseFind('\\')); //keep path
ReverseFind finds the zero-based index of the first matching character (from the end).
You could use the equivalent of sPath.find and look for the first ":" or ":\" character (without the quotes naturally).
Hope this helps.
Al
==================
The original message was:
I've got a set of filenames: some are to files which exist, others are to files which do not exist; some are absolute, others are relative; some are on local drives, others on network drives.
I'm looking for a way to extract the drive name from a file path, regardless of any of the above factors.
Can anyone give me a pointer of where to look for this?
Thanx.
|
|
|
|
|
Have a look at the _splitpath API function...
- Chris
==================
The original message was:
I've got a set of filenames: some are to files which exist, others are to files which do not exist; some are absolute, others are relative; some are on local drives, others on network drives.
I'm looking for a way to extract the drive name from a file path, regardless of any of the above factors.
Can anyone give me a pointer of where to look for this?
Thanx.
|
|
|
|
|
Hello,
I am trying to add a background image to a control. I was trying to use Mihai Filimon's method (see Adding background image to any control) but I am have 3 link errors, live "unresolved external... AtlComPtrAssign(..) ). I added atl.lib to my project settings. Is there any other thing I might have forgotten to do?
Thank you.
|
|
|
|
|
Hi!
There is no any problems of using the AtlComPtrAssign() method if you are creating the ATL project using MSVC wizard (I've tried it). If you are adding ATL support to an existing MFC application you can follow this steps:
1. From ClassView, select the project to
which you want to add ATL support, and
click the right mouse button.
2. From the popup menu, click New ATL Object.
3. When prompted, click Yes to add ATL support.
4. From the ATL Object Wizard dialog, select
the object you want to add.
Note If you only want ATL support without adding any
ATL objects, click Cancel in the ATL Object Wizard.
Good luck,
Alex Gorev,
Dundas Software.
==================
The original message was:
Hello, I am trying to add a background image to a control. I was trying to use Mihai Filimon's method (see Adding background image to any control) but I am have 3 link errors, live "unresolved external... AtlComPtrAssign(..) ). I added atl.lib to my project settings. Is there any other thing I might have forgotten to do? Thank you.
|
|
|
|
|
I am needing to create a Singleton COM component. This needs to have data served to several programs so of course needs to be an out of process server which leads me to using the ATL EXE server rather than a DLL or a MFC based COM object. It appears that I can create one rather straight forward from the ATL wizard under the new option in Visual Studio 6. However I am missing something. Although I can see the created component in the OleViewer via its TypeLib I can not access it to use in any programs. When trying to add it via "Project/AddtoProject/ComponentsAndControls" I get a message "File Does Not Exist".
Any pointers on what I am missing. Thanks Mike.
|
|
|
|
|
Hi Mike!
You should use the #import directive with the name of your TLB file. You can find more information about it in MSDN.
Regards,
Alex Gorev,
Dundas Software.
==================
The original message was:
I am needing to create a Singleton COM component. This needs to have data served to several programs so of course needs to be an out of process server which leads me to using the ATL EXE server rather than a DLL or a MFC based COM object. It appears that I can create one rather straight forward from the ATL wizard under the new option in Visual Studio 6. However I am missing something. Although I can see the created component in the OleViewer via its TypeLib I can not access it to use in any programs. When trying to add it via "Project/AddtoProject/ComponentsAndControls" I get a message "File Does Not Exist".
Any pointers on what I am missing. Thanks Mike.
|
|
|
|
|
I am using vc++ 6.00 and I am using drawtext to output text. I am not able to print characters above ascii 127. I tried to make them unsigned char, I also tried the /J option but nothing happens. Please help me.
|
|
|
|
|
It will depend on the font that you are using. I assume you are trying to print out characters like the box drawing ones (or foreign language chars). Many of the Windows fonts map only to a small square box (or some other boring shape) for chars above 127. Some of the OEM terminal fonts may be more useful for you. Of course it could be something else that isn't right. You should probably also check if you are using Unicode or not and make sure you are casting your strings with TCHAR - this could impact on it as well. Another thing would be the default language you are using.
Regards,
Gary Menzel
==================
The original message was:
I am using vc++ 6.00 and I am using drawtext to output text. I am not able to print characters above ascii 127. I tried to make them unsigned char, I also tried the /J option but nothing happens. Please help me.
|
|
|
|
|
Thanks for your kind suggestions Gary.
I was using Foxpro ODBC 2.5. Then I used Visual Foxpro ODBC Driver & the problem was solved.
==================
The original message was:
It will depend on the font that you are using. I assume you are trying to print out characters like the box drawing ones (or foreign language chars). Many of the Windows fonts map only to a small square box (or some other boring shape) for chars above 127. Some of the OEM terminal fonts may be more useful for you. Of course it could be something else that isn't right. You should probably also check if you are using Unicode or not and make sure you are casting your strings with TCHAR - this could impact on it as well. Another thing would be the default language you are using.
Regards, Gary Menzel
================== The original message was: I am using vc++ 6.00 and I am using drawtext to output text. I am not able to print characters above ascii 127. I tried to make them unsigned char, I also tried the /J option but nothing happens. Please help me.
|
|
|
|
|
within my class i created a struct and a CList template containing the struct. but i something goes wrong when i try to add a struct variable to the CList object. Whats wrong?
#include "StdAfx.h"
#include "Afxtempl.h"
//HoleVok.h
class CHoleVok
{
private:
typedef struct TABELLE
{
CString strSQL;
CString intTID;
int intVokAnzahl;
CList<int,int> clistGeprueft;
};
CArray <tabelle,tabelle&> arrTabellen;
CDatabase *db;
public:
bool fnConnect(CDaoDatabase &db);
};
___________________________________________
#include "stdafx.h"
#include "HoleVok.h"
//HoleVok.cpp
bool CHoleVok::fnConnect(CDaoDatabase &db)
{
TABELLE tabTest1;
tabTest1.clistGeprueft.AddTail(20);
tabTest1.clistGeprueft.AddTail(21);
tabTest1.intTID = 4;
tabTest1.intVokAnzahl = 200;
tabTest1.strSQL = "Das Wetter ist schoen";
arrTabellen.Add(tabTest1);
return true;
}
|
|
|
|
|
The CList is a template. You need to define what is being stored in its definition. such as.
typedef struct TABELLE
{
CString strSQL;
CString intTID;
int intVokAnzahl;
CList<int,int> clistGeprueft;
};
After this the following works fine.
TABELLE NewTab;
NewTab.clistGeprueft.AddTail(20);
NewTab.clistGeprueft.AddTail(21);
NewTab.clistGeprueft.AddTail(24);
int myval;
myval = NewTab.clistGeprueft.GetHead();
POSITION pos = NewTab.clistGeprueft.GetHeadPosition();
myval = NewTab.clistGeprueft.GetNext(pos);
myval = NewTab.clistGeprueft.GetNext(pos);
myval = NewTab.clistGeprueft.GetNext(pos);
myval = NewTab.clistGeprueft.GetNext(pos);
NOTE the last line here fails because the list had 3 elements and I did not test for a NULL position.
==================
The original message was:
within my class i created a struct and a CList template containing the struct. but i something goes wrong when i try to add a struct variable to the CList object. Whats wrong?
#include "StdAfx.h" #include "Afxtempl.h"
//HoleVok.h
class CHoleVok { private:
typedef struct TABELLE { CString strSQL; CString intTID; int intVokAnzahl; CList<int,int> clistGeprueft; };
CArray <tabelle,tabelle&> arrTabellen;
CDatabase *db;
public: bool fnConnect(CDaoDatabase &db);
}; ___________________________________________ #include "stdafx.h" #include "HoleVok.h"
//HoleVok.cpp
bool CHoleVok::fnConnect(CDaoDatabase &db) { TABELLE tabTest1; tabTest1.clistGeprueft.AddTail(20); tabTest1.clistGeprueft.AddTail(21); tabTest1.intTID = 4; tabTest1.intVokAnzahl = 200; tabTest1.strSQL = "Das Wetter ist schoen"; arrTabellen.Add(tabTest1);
return true; }
|
|
|
|
|
Benedikt,
I missed what the lt gt signs did to the code. Now my sample worked. Can you describe what goes wrong?
Given the code is not being post clearly is the problem with the CList or the CArray?
The following is adding the "pre" html prior to the code just to see what it looks like.
typedef struct TABELLE
{
CString strSQL;
CString intTID;
int VokAnzahl;
CList<int,int> clistGeprueft;
};
|
|
|
|
|
I think I've found the problem. CList doesn't provide a copy or an assignement operater witch is needed. So it is not possible to store a clist or a carray within a clist or a carray. But this is what i need!
|
|
|
|
|
Hi there.
I am creating a CEdit control using Create method. In that i am specifying the control to be right aligned. It works fine with Win NT. But, it turns centre aligned in Wnidows 95. It works properly in 98 also.
Please let me know if anybody knows the solution.
Thanx.
- Amit Engineer.
|
|
|
|
|
I am using StretchBlt to make a mirror image of the page.
While the normal page prints on when I try to use StretchBlt on this StretchBlt always return 1 but prints nothing. Pl. Help Me!. I am embeding the source func.
/* --------------------------------------------------- */
void CTprView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
int top,left,right,bottom;
RECT rt ;
pDC->SetMapMode (MM_ANISOTROPIC) ;
PrDC.SetMapMode (MY_MODE) ; // this is the CreatIC of the default printer driver
pDC->SelectObject (&pen) ;
PrDC.SelectObject (&pen) ;
top = TopMargin ;
left = (int)((LeftMargin * hPixPerMM) - (int)(hPixPerMM/1.5));
right = (int)((ColWith * 3.00) + (Gutter * 2.00) + (hPixPerMM * 1.5)) ;
bottom = (int)(vPixPerMM * m_PgLn);
if (m_mirror != TRUE) {
PreparePages (pDC, pInfo) ;
TestPage (pDC, pInfo) ;
} else {
MirrorDC.CreateCompatibleDC(pDC);
MirrorDC.SetMapMode (MY_MODE) ;
MirrorDC.SetTextColor (RGB (0,0,0));
MirrorDC.SetViewportOrg (0, 0) ;
MirrorDC.SetWindowOrg (0, 0) ;
PreparePages (&MirrorDC, pInfo) ; // if pages=1 then calculates pages into a CTypedPtrArray
TestPage (&MirrorDC, pInfo) ; // draws text,bitmaps & lines on the CDC provided
if (!IsInCalc) {
rt.top = top ;
rt.left = left;
rt.right = right;
rt.bottom = bottom;
PrDC.DPtoLP (&rt) ;
top=pDC->StretchBlt(left,top,right,-bottom,&MirrorDC,left,top,right,bottom,SRCCOPY);
CString cTmp ;
cTmp.Format("Ret. Value = %d", top) ;
MessageBox (cTmp, "S.Blt", MB_OK) ;
}
MirrorDC.DeleteDC ();
}
}
|
|
|
|
|
this is certainly beyond my knowledge to learn that array[-1] is valid in some cases.
i am shocked, stunned and desparate !
i am now examing an existing project and i am suspecting this is the cause of all evils.
but now somebody said this is perfectly legal.
okay okay..
let me draw the picture bigger.
there is this array of struct defined like this..
struct someStruct array[100] and i am assigning like this
array[-1].field1 = something.
so so..is this so called access the return address or read parameter directly ??
arghhh !!! what am i talking about ?? some1 pls resurrect me !!
|
|
|
|
|
It's my understanding that a[i] is identically equivalent to *(a + i). No restriction is made on the sign of i, so array[-1] is syntactically fine.
However, in your code example:
struct someStruct array[100];
array[-1].field1 = something;
That is accessing outside the bounds of the array. Bad move. It's just as bad as doing "array[2000].field1=xyz;"
|
|
|
|
|
<br />
It would only be useful in a small number of cases.<br />
<br />
Say, if you wrote a peice of code like this:<br />
<br />
char text[100];<br />
char *ref = text[1];<br />
if(*ref == ref[-1]) return FIRST_EQUALS_SECOND;<br />
<br />
However, I don't see why you would want to do that in any normal case.<br />
==================
The original message was:
this is certainly beyond my knowledge to learn that array[-1] is valid in some cases. i am shocked, stunned and desparate ! i am now examing an existing project and i am suspecting this is the cause of all evils. but now somebody said this is perfectly legal. okay okay.. let me draw the picture bigger. there is this array of struct defined like this.. struct someStruct array[100] and i am assigning like this array[-1].field1 = something.
so so..is this so called access the return address or read parameter directly ?? arghhh !!! what am i talking about ?? some1 pls resurrect me !!
|
|
|
|
|
I have an INF file with the following sections in it:
[Version]
Signature="$Windows NT$"
Provider=Gooroos Software
[Install]
CopyFiles=CopyFiles
[CopyFiles]
file1
[DestinationDirs]
CopyFiles=11 ; Same as %windir%\system32
[SourceDiskNames]
1="Installation"
[SourceDiskFiles]
file1=1
I can use this INF to install file1 just fine. However, if I try to create a disk space list for the Install section, I get an error. I.e:
SetupAddInstallSectionToDiskSpaceList(diskSpaceList, m_hInf, 0, "Install", 0, 0);
fails and GetLastError() returns a code of -536870654.
If I change the section name from "Install" to "CopyFiles", then the call succeeds, but when I query the drive list I get back an empty string. I.e:
SetupQueryDrivesInDiskSpaceList(diskSpaceList, NULL, 0, &driveListSize)
returns a list size of 1 character (i.e. just the terminating null byte).
Obviously I'm doing something wrong, so does anyone have an example of using a disk space list which actually works?
Thanx.
|
|
|
|
|
I've written a Developer Studio 6.0 add-in which changes the project's linker settings using AddToolSettings() and RemoveToolSettings().
Although my changes immediately appear in the Project->Settings windows, none of the Build commands will use the new settings until after I have closed and reopened the
workspace. Not even doing a Build->Clean helps.
Anyone know of a programmatic way of forcing the Build commands to pick up my changes?
Thanx.
|
|
|
|