|
Hi,
I have a Modal Dialog Box, When i click the minimize bar on the top right corner, It does not go to the task bar, instead it settles at the bottom left corner of the screen, what should I do to make it settle in the taskbar ?
Thanks,
Deepak Samuel.
|
|
|
|
|
are u using MFC or simple win32?
Don't try it, just do it!
|
|
|
|
|
Hi,
I am using MFC.
Thanks,
Deepak Samuel.
|
|
|
|
|
Hi
When you minimized the window, the OnMinimized function is called, you have to review the function or overwrite the actual implementation.
|
|
|
|
|
Visual C++
i think it's a trivial question but i don't know the right syntax:
i have, for example :
int ID1=70;
int age1=55;
String (or CString) Name="Bell";
CString All;
// i want to make All to be:
All=" The ID is " ID1 " and his age is " age1 " and his name is " Name
..
how to make this?
|
|
|
|
|
Check out the CString::Format function:
<br />
all.Format("The ID is %d and the age is %d", ID1, age1);<br />
Remember, even if you win the rat race, you're still a rat.
|
|
|
|
|
well i tell a how to achieve it with char*;
char[200] str="";
int i=20;
double d=10.00;
char* s="test string";
wsprintf(str,"The integer is %d and the double is %f and the character array contains %s",i,d,s);
NOW str WILL contain "The integer is 20 and the double is 10.000000 and the character array contains test string"
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
how to make clear that this struct has to be 2 bytes in size and NOT 3?
typedef struct _TEST
{
USHORT FragmentOffset: 13;
UCHAR MF: 1;
UCHAR DF: 1;
UCHAR Reserved: 1;
} TEST, *PTEST;
Thanks
Don't try it, just do it!
|
|
|
|
|
|
I can't, this struct is part of the IPv4 header.
Don't try it, just do it!
|
|
|
|
|
|
I did, but it doesn't work.
Don't try it, just do it!
|
|
|
|
|
How about making all the UCHARs to USHORT?
John
|
|
|
|
|
Thank you John, that works!
Don't try it, just do it!
|
|
|
|
|
Yes, you are right. But how strange ... although I remembered that in C++ syntax, we only have to write this way for bit field:
struct SS
{
unsigned A : 13;
unsigned B : 1;
unsigned C : 1;
unsigned D : 1;
};
But with pragma of VisualC++7, the previous acts different to:
struct SS
{
unsigned short A : 13;
unsigned short B : 1;
unsigned short C : 1;
unsigned short D : 1;
};
Maxwell Chen
|
|
|
|
|
Hi
If you have problems with the size structue you have to close your structure declaration between #pragma pack() instruction, you can get additional info at msdn.
|
|
|
|
|
I want to insert the values i get from a matrix, in the order thay are in a text file. I mean by this the values to keep their place, on lines and columns.
To read the values I did this:
double LocalMap::SquareValue(int i, int j)
{
for (i=0; i<nx; i++){
="" for="" (j="0;" j<ny;="" j++){
="" if="" (cellv[i][j]="">0){
cellsV[i][j]=cellV[i][j]*cellV[i][j];
if (cellsV[i][j]>noise_border){
ofstream BuiltMap; //mode écriture
BuiltMap.open ("C:\\My Files\\BuiltMap\\BuiltMap.txt", ios::in);
//open file
while (!BuiltMap.eof()){
//laisser i colonnes libres et j espaces libres
BuiltMap<<"\n"<<" "<
|
|
|
|
|
for (i = 0; i < nx; i++)
{
for (j = 0; j < ny; j++)
{
if (cellV[i][j] > 0)
{
cellsV[i][j] = cellV[i][j] * cellV[i][j];
if (cellsV[i][j] > noise_border)
{
ofstream BuiltMap;
BuiltMap.open("C:\\My Files\\BuiltMap\\BuiltMap.txt", ios::in);
while (! BuiltMap.eof())
{
BuiltMap << "\n" << " " << cellsV[i][j];
}
}
else
cellsV[i][j] = NULL;
}
}
} Aside from the fact that the opening/closing of the file should be done outside of the loops, I'm not quite sure what you are doing here. You've got an ofstream object that is opening a file for input (i.e., reading), yet you are usign the << operator to write to it. Is this intentional?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I thought ifstream is made for reading files only, and ofstream to be able to write into file. Did I miss something there?
I want to write the values cellsV[i][j] into the BuiltMap file.
THX
|
|
|
|
|
So shouldn't you be opening the file with ios::out instead?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I am seeing an interesting problem using the SortChildrenCB
functionality in the CTreeCtrl class. When I add items to my
treectrl, I set the item data correctly with SetItem, along with some
other things, like the state, statemask. For my "private" item data I
am storing the HTREEITEM that I got back from the
CTreeCtrl::InsertItem call. I correctly cast it to an LPARAM from an
HTREEITEM.
The item gets added correctly and the SetItem also seems to work ok.
So, if I added two nodes to the tree the following values are used:
name1: "apples"
itemdata1: 713A8 (the HTREEITEM of the first node)
name2: "model"
itemdata2: 74008 (the HTREEITEM of the second node)
After adding each node, I fill the appropriate TVSORTCB structure as
follows:
tvs.hParent = parentH; // HTREEITEM of parent node
tvs.lpfnCompare = CompareItems; // address of my compare callback
routine
tvs.lParam = (LPARAM) &ctlTree; // pointer to my treectrl
ctlTree.SortChildrenCB(&tvs);
Now, when my callback routine gets called after adding the second item
to determine which way to sort the items, it gets called with the
itemdata of the first item, itemdata of the second item, and the "sort
parameter. I cast these accordingly:
CTreeCtrl* pMyTreeCtrl = (CTreeCtrl*) lParamSort;
// the lParam of an item is just it's handle
HTREEITEM hTreeItem1 = (HTREEITEM) lParam1;
HTREEITEM hTreeItem2 = (HTREEITEM) lParam2;
The problem is as follows:
the HTREEITEM of the first item gets munged -- by 2. So what I see
in the callback routine for HTREEITEMS is as follows:
hTreeItem1: 713AA (the HTREEITEM of the first node)
hTreeItem2: 74008 (the HTREEITEM of the second node)
Notice the difference in the value of the first handle. It should be
713A8, which is the correct node handle. This fouling up my sorting.
My question is this, to node handles persist? Do they live as long as
the tree node exists? Or, do they get reassigned during
expansion/contraction? In the past, I have hung pointers of more
complex "item data" on tree nodes without trouble. Of course I had to
be responsible for deallocating them when appropriate. But in this
case I thought I was safe using the HTREEITEM as item data, since
given that I could query the tree node for the sorting information I
needed.
Anyone have any ideas on this or have seen this behavior before?
Thanks in advance.
Roy Berger
roybrew@att.net
Regards,
Roy
_____________
Roy H. Berger
roybrew@att.net
|
|
|
|
|
An error occured when I use a function called "PESDEMUX_ProcessFile" which is defined in a Dll (XtlPes.dll) (I have no errors at compilation).
The error message I have is "Unhandled exception in Appli.exe (XTLPES.DLL): 0xC0000005:Access Violation."
The code I used is:
HINSTANCE g_hDllXtlPes; // Global Variable defined in the general class
g_hDllXtlPes = LoadLibrary("XtlPes.dll"); //
typedef LONG (__cdecl *PESDEMUX_ProcessFile)(CHAR*,CHAR*,INT);
PESDEMUX_ProcessFile pPESDEMUX_ProcessFile;
CHAR chInFileName[255];
strcpy(chInFileName, m_csPCFileName); //Conversion CString to CHAR*
CHAR chOutFileName[255];
m_csPCFileName = m_csPCFileName + ".mpg";
strcpy(chOutFileName, m_csPCFileName); //Conversion CString to CHAR*
INT Type = 1;
if (theApp.g_hDllXtlPes != NULL)
{
pPESDEMUX_ProcessFile = (PESDEMUX_ProcessFile)GetProcAddress(theApp.g_hDllXtlPes,"PESDEMUX_ProcessFile");
if (!pPESDEMUX_ProcessFile)
{
FreeLibrary(theApp.g_hDllXtlUsb);
return FALSE;
}
else
{
BOOL BResult = TRUE;
BResult = pPESDEMUX_ProcessFile(chInFileName,chOutFileName,Type);
}
}
Does someone have an idea ?
Thank's for advance.
|
|
|
|
|
use a debugger to determine what is going wrong!
Don't try it, just do it!
|
|
|
|
|
That's what I've done... But the function I use always returns FALSE...
Any ideas?
|
|
|
|
|
If LoadLibrary() fails, you shouldn't bother doing that other stuff.
HINSTANCE g_hDllXtlPes;
g_hDllXtlPes = LoadLibrary("XtlPes.dll");
if (NULL != g_hDllXtlPes)
{
typedef LONG (__cdecl *PESDEMUX_ProcessFile)(CHAR*,CHAR*,INT);
PESDEMUX_ProcessFile pPESDEMUX_ProcessFile;
CHAR chInFileName[255];
strcpy(chInFileName, m_csPCFileName);
CHAR chOutFileName[255];
m_csPCFileName = m_csPCFileName + ".mpg";
strcpy(chOutFileName, m_csPCFileName);
INT Type = 1;
pPESDEMUX_ProcessFile = (PESDEMUX_ProcessFile)GetProcAddress(theApp.g_hDllXtlPes,"PESDEMUX_ProcessFile");
if (NULL != pPESDEMUX_ProcessFile)
{
BOOL BResult;
BResult = pPESDEMUX_ProcessFile(chInFileName,chOutFileName,Type);
}
else
{
DWORD dwResult = GetLastError();
FreeLibrary(theApp.g_hDllXtlUsb);
return FALSE;
}
}
else
DWORD dwResult = GetLastError(); Note the calls to GetLastError() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|