|
Stephen Hewitt wrote: A process called "decay" occurs and you lose the size info
Not just that, but you also effectively change the type of the variable - an array is generally a valid location in memory (whose location cannot be changed easily), while a pointer can point to a valid location in memory. (This difference is also important when optimizing code.)
Peave!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Since you have to put the returned array in an array anyway, you can create this "reception" array before calling the function and pass it as a parameter to the function. I think this is a much better solution than trying to "return" it, even burried in a struct.
~RaGE();
|
|
|
|
|
ahhhh, good ol' C runtime
Well done Mr "Diplomacy" ;P
|
|
|
|
|
V2.0 is too much for me. I'll go back to V1.6.
~RaGE();
|
|
|
|
|
v3.0 release date is set to 02/05/06... don't forget it
|
|
|
|
|
Hi i am doing a project and am making a tetris game in C++ V 6.0. So far i have crated the main menu screen... now i need to draw out a grid and start to make shapes fall... it seems i dont know how to do this. Does anyone have any tips or any codes i could have a look at??
Cheers for the help guys!
|
|
|
|
|
The best option is probably to create a custom control and do all the drawing yourself. Take a look at the miscellaneous controls on this site to see how to make one (it is not easy). Then to make the shapes fall, I think a timer will do that.
|
|
|
|
|
Hi!
Another way how to find out how to do that is to have a look at some related articles here on codeproject. Just type "tetris" to the search bar and you will get some hits, e.g.:
http://www.codeproject.com/cpp/CImgTetris.asp[^]
Best regards,
Marcus.
|
|
|
|
|
To start without debug is OK, but when I press F5 to start debugging, then it tells me that:
Debugging information for "....exe" cannot be found or does not match.
Binary was not built with debug information.
The "Solution Configurations" has already be set as "Debug".
Why cannot start debugging?
The problem only exists in C++, while C# is OK.
I've installed fully except x64 choice in C++.
VS2005 team suite edition.
华夏光宇世界,文明引领着我纵横驰骋于天地之间。
|
|
|
|
|
Open the project propertiesm choose 'General' under the 'C/C++' item. There you should see "Debug information Format". Make sure "Program Database" at least is selected.
Hope this helps
|
|
|
|
|
Thank you but the problem still stay there.
Having altered the "Debug Information Format" to "Programme Database", press F5.......
The Output Window tells me that:
"
'HuffmanTree.exe': Loaded 'C:\Documents and Settings\libo\My Documents\Visual Studio 2005\Projects\HuffmanTree\debug\HuffmanTree.exe', Binary was not built with debug information.
'HuffmanTree.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'HuffmanTree.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
The program '[5592] HuffmanTree.exe: Native' has exited with code 0 (0x0).
"
You see. I am coding the programme called "HuffmanTree", and to start without debug is OK.
华夏光宇世界,文明引领着我纵横驰骋于天地之间。
|
|
|
|
|
Dear All,
I am using the following code to get the printer status.
BOOL bSuccess = FALSE;
char *pPrinterName = NULL;
DWORD size = 0;
GetDefaultPrinter(pPrinterName, &size);
pPrinterName = new char[size+1];
memset(pPrinterName,'\0',size+1);
if(GetDefaultPrinter(pPrinterName, &size) == FALSE)
{
delete[]pPrinterName;
return ;
}
PRINTER_DEFAULTS* pd=NULL;
BOOL bOpen = OpenPrinter(pPrinterName, &hPrinter, pd);
if(!bOpen)
{
delete[]pPrinterName;
return;
}
delete [] pPrinterName;
GetPrinter(hPrinter, 2, NULL, 0, &dwBytesNeeded);
BOOL bSuccess = FALSE;
PRINTER_INFO_2 *pPrinterInfo;
pPrinterInfo=(PRINTER_INFO_2*)GlobalAlloc(GPTR,dwBytesNeeded);
bSuccess = GetPrinter(hPrinter, 2, (LPBYTE)pPrinterInfo, dwBytesNeeded,&dwBytesReturned);
if(bSuccess == FALSE)
return FALSE;
bSuccess=TRUE;
if(pPrinterInfo->Status != 0)
{
if((pPrinterInfo->Status)&PRINTER_STATUS_BUSY)
{
ShowMessage("Printer is busy");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_DOOR_OPEN)
{
ShowMessage("Printer door is open");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_ERROR)
{
ShowMessage("Printer is in error state");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_INITIALIZING)
{
ShowMessage("Printer is initializing");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_IO_ACTIVE)
{
ShowMessage("Printer is in an active state");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_MANUAL_FEED)
{
ShowMessage("Printer is in a manual feed state");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_NO_TONER)
{
ShowMessage("Printer is out of toner");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_NOT_AVAILABLE)
{
ShowMessage("Printer not present");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_OFFLINE)
{
ShowMessage("Printer is offline");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_OUT_OF_MEMORY)
{
ShowMessage("Printer is out of memory");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_OUTPUT_BIN_FULL)
{
ShowMessage("Printer's output bin is full");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_PAGE_PUNT)
{
ShowMessage("Page punt error");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_PAPER_JAM)
{
ShowMessage("Paper is jammed in the printer");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_PAPER_OUT)
{
ShowMessage("Printer is out of paper");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_PAPER_PROBLEM)
{
ShowMessage("Printer has a paper problem");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_PAUSED)
{
ShowMessage("Printer is paused");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_PENDING_DELETION)
{
ShowMessage("Printer is deleting a print job");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_POWER_SAVE)
{
ShowMessage("Printer is in power save mode");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_PRINTING)
{
ShowMessage("Printer is printing");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_PROCESSING)
{
ShowMessage("Printer is processing a print job");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_SERVER_UNKNOWN)
{
ShowMessage("Printer status is unknown");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_TONER_LOW)
{
ShowMessage("Printer is low on toner");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_USER_INTERVENTION)
{
ShowMessage("Printer has an error that requires the user to do something");
bSuccess = FALSE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_WAITING)
{
ShowMessage("Printer is waiting");
bSuccess = TRUE;
}
if((pPrinterInfo->Status)&PRINTER_STATUS_WARMING_UP)
{
ShowMessage("Printer is warming up");
bSuccess = TRUE;
}
}
GlobalFree(pPrinterInfo);
The "pPrinterInfo->Status" parameter always returns "0" for the local
USB printer.Can anyone please tell me what may be the problem.
Thanking you in advance,
regards,
Ashwath Hegde.
|
|
|
|
|
0 might be a valid return for "normal/online/ready" status. You can check by intentionally "breaking" the printer by taking it offline, removing paper from it, opening it up, etc., and see if the status value changes accordingly.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
hi,
I have checked all those conditions but it does not work.I am using Windows XP machine.Should i install any service pack for this.
|
|
|
|
|
I ran into similar issues with a serial port printer and one connected to the parallel port. It turns out all 'suggestions' I discovered at Microsoft or on the Internet pointed to writing a 'printer monitor' type of driver. The notion was that the actual 'status' did not 'percolate' all the way up to this function call which should OBVIOUSLY be receiving the status. So, what I am trying to say is that I don't think your problem is specific only to the USB printer.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Hi,
I want to have a palette which will have some icons.. As I click the icon the command will become active.. if I kept the left mouse button pressed, I will see the sub command Icons from which any icon can be selected by moving pressed mouse button.. this sub palette can be dragged out too to have sub palette.
Thanks
Lee
|
|
|
|
|
I'm holding on learning how to make dll files, and now i have desided to move my settings dialog into a project of its own, and load it when i need it, otherwise keep it unloaded. I got a problem though. I am using a friend om mines sourcecode, and he is using extern CAppModule _Module; in the executeable, and _Module is used in the settings dialog:
<br />
_Module.AddSettingChangeNotify(pThis->m_hWnd);<br />
When i compile the dialog i get this error:
<br />
error C2065: '_Module' : undeclared identifier<br />
My problem is: How do i get _Module into my new project?
Nicolai Mortensen
|
|
|
|
|
Probabily you should declared it as extern variable. Don't know.
|
|
|
|
|
It is declared as extern in the original project.
|
|
|
|
|
Maybe the main project needs a header file with the original declaration. Try it!
|
|
|
|
|
The class CComModule is part of ATL - CAppModule is a wizard generated class derived from CComModule which is used in EXE projects. Given that you're learning DLLs we'll concentrate on CComModule . Follow these steps:
1. In your "stdafx.h" file, after the #include <atlbase.h> add the following line:
extern CComModule _Module;
2. In one of your .CPP files (normally the one that contains the DLL entry point) add the following at global scope:
CComModule _Module;
3. In the DLL_PROCESS_ATTACH fork of your DllMain add the following:
_Module.Init(NULL, hinstDLL);
4. In the DLL_PROCESS_DETACH fork add the following:
_Module.Term();
Normally the wizard does all this boiler plate stuff when you generate the project (ATL project).
Steve
|
|
|
|
|
Thank you, that did the trick
|
|
|
|
|
Hi,
I have a prob.I created a List Ctrl from CListCtrl.It contains default scroll bar.While Horizontal Scrolling i have to fix ( that is i don't want them to move) the first
three columns and all the others have to scroll.
cheers
Dinu John
-- modified at 6:40 Wednesday 29th March, 2006
|
|
|
|
|
ListControl doesn't directly support static columns, the only way I can think of doing it would be by using it as a virtual list and getting clever with it... Probobly to much work for little gain though.
IMO your going to be better off attacking it from a different angle and using a control pre-designed to handle static columns, such as the excellent CGridCtrl[^] control written by Chris M.
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
Hi
I have wrote one dialog based MFC application which i run on Windows 2000 Professional.
In this application i capture different windows messges. I want to do certaing things when the power cable is removed from laptop and it automatically switches to battery status. And again I want to get notification when power becomes available.
For this I use WM_POWERBROADCAST message. I have written one function as
LRESULT OnMessagePowerBroadcast(WPARAM wParam, LPARAM lParam);
Declared in my header file.
And applied as
LRESULT MyClass::OnMessagePowerBroadcast(WPARAM wParam, LPARAM lParam)
{
MessageBox("WM_POWERBROADCAST");
return 0;
}
BEGIN_MESSAGE_MAP(MyClass, CDialog)
ON_MESSAGE(WM_POWERBROADCAST, OnMessagePowerBroadcast)
END_MESSAGE_MAP()
Here I get notification whenever my laptop switches from power to battery. But the problem is : It shows me message box even when power get in. for this I use wParam and compare it with the given values, and I get PBT_APMPOWERSTATUSCHANGE all the time. How to distinguish that Power is in or power is out?
Right now it gives me same message as ( "WM_POWERBROADCAST")even when power is in and when it's out.
Any idea how to distinguish it?
Regards,
Mahesh
|
|
|
|