|
John Strudwick wrote: if there is a single switch somewhere that will let my code compile as it was?
Possibly; it sounds like you're set up for a UNICODE build. Take a look at your stdafx.h file. If the symbol UNICODE is #define 'd, try commenting it out and rebuilding the solution.
John Strudwick wrote: I also don't understand why it's using ATL and not MFC - I craeted a new MFC project
Back in MFC 7.0 (Visual Studio 2002) they switched from separate CString implementations within ATL and MFC to a single, common implementation. As part of that, they improved the type-safety of the various constructors and assignment operators.
Software Zen: delete this;
|
|
|
|
|
Thanks Gary - that has solved the problem
I went into the properties dialog and changed from unicode to not set - works a treat
Thanks again
|
|
|
|
|
You're welcome. I believe I remember reading that the wizards in VS2005 changed from a default of building ANSI applications to UNICODE.
Believe it or not, there are advantages to building apps as UNICODE. They are much easier to translate to other languages (which may not be a concern for you). They also have something of a performance advantage. Windows itself uses UNICODE. With ANSI applications, there is an implicit conversion from ANSI strings to UNICODE with strings you pass to Windows, and the reverse when Windows returns strings to you.
Software Zen: delete this;
|
|
|
|
|
and where should I call it?
Hello all,
in the PostNCDestroy overriden function of the main dialog I want to kill the timer that is running there, I'm calling something as simple as KillTimer(0); and this should work, but it makes the entire application to close suddenly.
Any idea?
Thank you in advance.
|
|
|
|
|
PostNcDestroy() is called after the corresponding window has been destroyed, which is why the KillTimer is failing. You don't need to call KillTimer in this case, because the window destruction takes care of it for you.
Software Zen: delete this;
|
|
|
|
|
Thank you, I'll remove that commented line now.
|
|
|
|
|
hi.I wanted to "benchmark" some sorting algorithms I learned from a book .
The problem is I cannot reserve into memory more than 16383 long variables.
That means 64kB .
I've made some research and understood that in real mode a segment is limited to 64 kB.I changed the compiling mode to large , but for nothing.
_/||||\_
/|- -|\
\--/
|
|
|
|
|
It sounds like Borland C 3.1 is an MS-DOS compiler that generated 'real mode' executables. In real mode, no single data structure could be larger than 64K bytes. There were several memory models that specified the sizes of code and data supported. IIRC, the 'large' model specified code and data pointers that were four bytes; a two byte segment and a two byte offset. This let you have more than a total of 64K code and 64K data. Individual data elements (like your array) were still limited to 64K each, but you could have more than one of them.
There are more modern C and C++ compilers out there that are free for the download. Microsoft has Visual Studio 2005 C++ Express, I believe Borland makes a free version of their compiler available, and there's the open source 'gcc' compiler.
Software Zen: delete this;
|
|
|
|
|
Use another compiler...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: Use another compiler...
Exactly my thoughts
|
|
|
|
|
Hi!
I have a few problems to add combo box within my dialog box and add the strings to that combobox using "AddString()" function within the "OnInitDialog()" function.
my coding like...
Cdialogex::OnInitDialog()
{
................
................
m_Combobox1.AddString("vc++");
.......................
......
}
Debug Assertion Failed!
Program: ...
File: f:\rtm\vctools\vc7libs\ship\atlmfc\include\afxwin1.inl
Line: 248
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
But when i remove the code " m_Combobox1.AddString("vc++"); " ,program run successfully....
Now i am using VS. 8.0
Can anyone help me!!!
|
|
|
|
|
Taking a guess, the m_Combobox1 variable isn't properly associated with a combobox control in the dialog. You can do this in one of two ways.
The first method: Add a combobox control to the dialog with the resource editor. In your OnInitDialog function, call m_Combobox1.SubclassDlgItem(IDC_MYCOMBOBOX,this); , where IDC_MYCOMBOBOX is the resource identifier for the control.
The second method: Create the combobox control directly:
CRect rect(10,10,100,200);
m_Combobox1.Create((WS_CHILD | WS_VISIBLE | WS_TABSTOP),
rect,
this,
IDC_MYCOMBOBOX); rect is the location in the dialog where you want the combobox, and IDC_MYCOMBOBOX is the ID you want assigned to the control.
After you've done either of these, you can call the AddString method to add items to the control.
Software Zen: delete this;
|
|
|
|
|
How to do you declare m_Combobox1 ?
|
|
|
|
|
Thank you very much......
|
|
|
|
|
You're wolcome but for what?
|
|
|
|
|
hi,
I am new to programming ! I am just writing match game ! I am trying to move the letter to concerning place .. so I created two dimen-array for it .. but I have problem with moving those to concerning place .. here is my some code of that ... plese help me out to work.. thanks in advance..
code:
#include<iostream>
using namespace std;
void display(void);//Show the table that have card name in side
void moveCard();
//void playagian();
//===========================================================================================================
char way;
const int ORDER=3;//row number
const int COLUM=4;//colum number
char cardname[][ORDER][COLUM]={"D2","S4","H6","C5","D2","S4","AD","C5","H6","__","AD",}; // char name of card
//===========================================================================================================
int main()
{
cout << endl;
cout << endl;
cout <<" ----->>>>> Match Game <<<<<----- ";
cout << endl;
cout << endl;
cout <<"________________________________________________" << endl;
for(int head =0; head<4; head++)
cout << " | " << head << " |";
cout << endl;
cout <<"________________________________________________" << endl;
display();
cout <<"________________________________________________";
cout << endl;
cout << endl;
cout << " what you want to move?? ";
cout << endl;
cout << endl;
cin >> cardname[ORDER][COLUM];
cout << endl;
cout << endl;
cout << "What you want to go right,left, up,down" << endl ;
cin >> way;
cout << endl;
cout << endl;
moveCard();
cout << endl;
cout << endl;
//playagain();
cout << endl;
return 0;
}
//===========================================================================================================
void display(void)
{
for (int i=0;i<order;i++)
{
="" cout="" <<="" endl;
=""
="" for="" (int="" j="0;j<COLUM;j++)
" "="" |="" <<cardname[i][j]<<="" |";
="" endl;
="" if="" (i!="ORDER-1)
" <<"____________";
="" }
=""
}
="" =="========================================================================================================
void" movecard()
{="" char="" way;
="" switch="" (way)="" case="" 'r':="" right
="" cin="">> cardname[ORDER][COLUM];
cout << endl;
display();
cout << endl;
break;
case 'L':
case 'l': // left
cin >> cardname[ORDER][COLUM];
cout << endl;
display();
break;
case 'U':
case 'u':// up
cin >> cardname[ORDER][COLUM];
cout << endl;
display();
break;
case 'D':
case 'd'://down
cin >> cardname[ORDER][COLUM];
cout << endl;
display();
break;
default:// error
cout << "Inviable " << endl;
break;
}
}
|
|
|
|
|
When I say bitmap, I don't mean a picture of my missus. I have an array of bytes which represents free slots in a table ( an allocation table ). If a bit is set the slot is used. Within the table of slots records are stored. Each slot has a predetermined size, and each stored record may span one or more slots. The bitmap is used similar to a FAT table.
Testing if a single bit is set is relativly easy, but what is the most efficient way to find a series of unset bits?
For example:
The bitmap = FF983F1F ( 1111 1111 1001 1000 0011 1111 0001 1111 )
record size will span 3 slots, so I need to find a group of 3 unset bits.
at bit #10 there are only 2 slots available
at bit #14 there are 5 available
at bit #24 there are 3 available
I need to quickly find #14 or #24 and convert it to an offset into the slot table. What is the most efficient way of scanning this bitmap?
|
|
|
|
|
I think you can use a look-up table for each byte, though the table must be alittle elaborate, to take into accout sequence of zeroes extending to the neighbours of the bytes themselves.
for instance, if you have
11111000 00111000 ...
must be smart enough to tell you that the empty sequence of the first byte can be continued with that of the following one.
hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
As per my requirement is concerned ,When I press the close(X) button at the top right corner , I need a dialog box to be displayed.Where should I handle (add the code for) this ? Hope I am clear.
Thanks in advance.
Taruni
Taruni
|
|
|
|
|
Handle the WM_CLOSE message.
|
|
|
|
|
In standard Multiple documents project, compile auto create a CChildFrame class that derive from CMDIChildWnd. I overload OnCreate function, In this function I can use GetClientRect() to get window size, but, how can I set size of window?
|
|
|
|
|
Use MoveWindow() or SetWindowPos().
|
|
|
|
|
|
Dear all,
is any body help me in DRM?.
Please code Following.
<br />
WCHAR *Encoder::GenerateKeyID()<br />
{<br />
HRESULT hr;<br />
IWMWriter *m_pWriter = NULL;<br />
hr = WMCreateWriter( NULL, &m_pWriter );
IWMDRMWriter *pDRMWriter = NULL;<br />
hr = m_pWriter->QueryInterface(IID_IWMDRMWriter,(void **) &pDRMWriter);
DWORD d_KeyID = NULL;<br />
hr = pDRMWriter->GenerateKeyID(NULL,&d_KeyID);
WCHAR *w_KeyID = new WCHAR[d_KeyID];<br />
ZeroMemory(w_KeyID,sizeof(WCHAR)* d_KeyID);<br />
hr = pDRMWriter->GenerateKeyID(w_KeyID,&d_KeyID);
return w_KeyID;<br />
}<br />
i caught this error @ debugging and due to this the file remains un protected.
if this will success then and then the file will be protected.
so please help!!
thank you
amit mistry
|
|
|
|
|
Hello, I need help with the following problem.
I am trying to print a PNG image with pixel-by-pixel transparency values. I know there are different ways to accomplish this, some printers have hardware support of the PNG and JPG formats. However, I am doing it in an old-fasioned way, to avoid as much as possible dependency on printer's capabilities.
I load PNG file, convert it into bitmap (32pits-per-pixel) with libpng library, then blend it with whatever background I have currently on a DC, and output the result. There are 2 ways to do this:
1. Using AlphaBlend() function. Unfortunately, none of the printers around (including some brand-new ones) report support for this function, i.e. (GetDeviceCaps(hDC, SHADEBLENDCAPS) & SB_PIXEL_ALPHA) is 0.
2. Reading the contents of the printer's device context using BitBlt() and GetDIBits() calls, manually blending the pixel values, and outputing the result to printer's DC. The printer device reports that it supports both BitBlt() and GetDIBits():
(GetDeviceCaps(hDC, RASTERCAPS) & RC_BITBLT) is non-zero
(GetDeviceCaps(hDC, RASTERCAPS) & RC_DI_BITMAP) is non-zero.
However, the call to GetDIBits() returns me all pixels on printer's DC as black. Here is my code:
//******************************************************************
// hDC is printer's DC in this case
HDC hCaptureDC = CreateCompatibleDC(hDC);
// img structure contains width, height, etc. for the image
HBITMAP hCaptureBitmap = CreateCompatibleBitmap(hDC, img->width, img->height);
HGDIOBJ h = SelectObject(hCaptureDC, hCaptureBitmap);
ret = BitBlt(hCaptureDC, 0, 0, img->width, img->height, hDC, x, y, SRCCOPY);
if (ret == 0)
{
ret = GetLastError();
goto exit_proc;
}
memset (&bmpInfo, 0, sizeof(bmpInfo));
bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
bmpInfo.bmiHeader.biBitCount = 32;
// The bitmap identified by the hbmp parameter must not be selected into a device context when the //application calls this function (see MSDN page on GetDIBits), so deselect it:
SelectObject (hCaptureDC, h);
ret = GetDIBits(hCaptureDC,hCaptureBitmap,0,0,NULL,&bmpInfo,DIB_RGB_COLORS);
if (ret == 0)
{
ret = GetLastError();
goto exit_proc;
}
if (bmpInfo.bmiHeader.biBitCount != 32)
{
bmpInfo.bmiHeader.biBitCount = 32;
bmpInfo.bmiHeader.biSizeImage = 0;
}
if(bmpInfo.bmiHeader.biSizeImage<=0)
{
bmpInfo.bmiHeader.biSizeImage = mpInfo.bmiHeader.biWidth*abs(bmpInfo.bmiHeader.biHeight) * ((bmpInfo.bmiHeader.biBitCount+7)/8);
}
if((pBuf = (BYTE *)malloc(bmpInfo.bmiHeader.biSizeImage))==NULL)
{
ret = -1;
goto exit_proc;
}
bmpInfo.bmiHeader.biCompression = BI_RGB;
bmpInfo.bmiHeader.biBitCount = 32;
ret = GetDIBits(hCaptureDC,hCaptureBitmap,0,bmpInfo.bmiHeader.biHeight,pBuf, &bmpInfo, DIB_RGB_COLORS);
if (ret == 0)
{
ret = GetLastError();
goto exit_proc;
}
//******************************************************************
Is there something I am doing wrong?
P.S. The above code works perfectly on screen DC. The problem occurs only with printers.
|
|
|
|
|