|
Yes ofcourse, and there are other methods to facilitate interprocess communication (shared Memory in DLL's for instance).However, from the original question it occurred to me that the OP had a picture in mind, of memory, similar to the old 16 bit windows, (where All Processes addressed physical memory), and also had little understanding of Logical vs Physical memory.
He seemed to think that somehow the program loader translates from logical to physical memory, (which is ofcourse NOT the case), and seems to miss the entire concept of logical memory.
So, I did not mention the exceptions, and workarounds, but concentrated on the basic tennet, that each process has it's own private 4GB memory space, where (in principle at least) other processes cannot tresspass.
Thanks for your comment though,
Regards
Bram van Kampen
|
|
|
|
|
GetlastError() returning 87 when i use EndPage() in my printing application...please let me know the reason
kir_MFC
|
|
|
|
|
kir_MFC wrote: GetlastError() returning 87 when i use EndPage() in my printing application...
Strange, 87 is: "The parameter is incorrect.".
Did EndPage() fail? Could you post the relevant code?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
if (!screen_print)
{
//debug(_S("prt line: abort %d '%s'"), fAbort, buf);
/* output current line */
/*
CODE STARTS --> RFC 40589
DATE --> 26/03/2007
*/
//Check if this is House Account Report
if (bIsHouseAccountReport)
{
HFONT m_hNewFont;
LOGFONT m_lfOldFont, m_lfNewFont;
//Get the current font and this will be our old font
::GetObject(hPrinterFont,sizeof(LOGFONT),&m_lfOldFont);
//Copy the oldfont to new font
m_lfNewFont = m_lfOldFont;
//Change the face name of the new font to "Courier New" as this is the only
//font in which all columns are aligned properly
_tcscpy(m_lfNewFont.lfFaceName, "Courier New");
m_hNewFont = CreateFontIndirect(&m_lfNewFont);
::SelectObject(pdc,m_hNewFont);
//Textout with the newly selected font
TextOut(pdc, 0, (CurrentLine - 1) * LineSpace, buf, strlen(buf));
//Select the old font for other reports to print as it is
::SelectObject(pdc,hPrinterFont);
}
/*
CODE ENDS --> RFC 40589
*/
else
TextOut(pdc, 0, (CurrentLine - 1) * LineSpace, buf, strlen(buf));
CurrentLine += 1;
/* check for page breaks */
if (CurrentLine > LinesPerPage)
{
CurrentLine = 1;
CurrentPage += 1;
if ( hPrinterFont != 0 )
{
SelectObject( pdc, hOldFont );
}
prt_set();
IOStatus = EndPage(pdc);
DWORD dw = GetLastError();
if(dw)
MessageBox (NULL, TEXT ("Hello, Windows 98!"), TEXT ("HelloMsg"), 0) ;
if ( hPrinterFont != 0 )
{
SelectObject( pdc, hPrinterFont );
}
if (IOStatus < 0 || fAbort)
{
fAbort = TRUE;
return -1;//RFC 78192
}
StartPage(pdc);
return -1;
}
}
/* screen print */
else
{
FIOW::fprintf(prtfile, _S("%s\n"), buf);
CurrentLine += 1;
if (CurrentLine > LinesPerPage)
{
CurrentLine = 1;
CurrentPage += 1;
return -1;
}
}
kir_MFC
|
|
|
|
|
Please use the "code block " button to post code snippets.
Is it the printer device context pdc valid (I can't spot its initialization in code provided)?
Have you called StartDoc and StartPage , before actually calling EndPage (again I can't see the above calls).
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You are calling GetLastError() before checking if EndPage failed. If EndPage succeeds it will not call SetLastError, so if GetlastError returns 87 it is probably from another function call that failed.
Wout Louwers
|
|
|
|
|
Last Error 87 = "The parameter is incorrect.".
So I would guess you use the wrong or an invalid device context or your device context
is not able to do print jobs or you just forgot to call StartPage on this device context before.
Edit: Oh sorry I saw you use the EndPage() function. So I would look if the internal used device context is valid (see above).
Greetings
Covean
|
|
|
|
|
Hi,
I need to browse to a folder and get the path I have browsed to so that I may store files in that location.
Should I use CFileDialog, which appears to always need a file extension and a file selected before I can return, or is there a more appropriate way of doing this?
I know I can get the path name with a selected file, but I dont want to have to select a file to get the path, if that makes sense.
TIA
Tony
|
|
|
|
|
You can consider using SHBrowseForFolder() API to browse folders.
|
|
|
|
|
If you insist on using the file dialog instead of the folder browse dialog, you can try to hide away the filename edit field on the dialog, write some dummy text into it from code and after the user closes the dialog with OK you simply cut away the filename and you get the folder the user selected. This probably poses some other issues one has to handle but it can be done as it has been done already.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi All
I have a problem to use command "describe tablename" in mfc vc++."Describe tablename" is working well in oracle SQl plus.
Here is code
_ConnectionPtr m_pConn;
_RecordsetPtr pRecordset;
m_pConn->Open (_bstr_t ("Provider=OraOLEDB.Oracle;PLSQLRSet=1;Data Source=orcl"),_bstr_t ("system"), _bstr_t ("password"), adModeUnknown);
pCommand->ActiveConnection = m_pConn;
CString fileddetail="describe supplier";
pRecordset=m_pConn->Execute(_bstr_t(fileddetail), 0, adCmdText);
Error is here
OraOLEDB Error: -2147217900 ORA-00900: invalid SQL statement IDispatch error #3092
Connection part is working well.
I know some member told me this is a DBA forum question why you post here.But one thing describe or DESC command is working well in oracle.So i think it's a question of MFC VC++.
Please help me
|
|
|
|
|
The Error messages means there is not this accout in the security database.Please check out the database accout name is right or wrong,espicaly look at using space in string or not.
|
|
|
|
|
Hi,
What is the difference between hash_map and hash_multimap?
Can you please help me in implementing hash_multimap in VS 2008 (for C++) with
Key as const char*
Value as Class (some class say mycalss).
After implementation how to insert the values?
Thanks,
nandu
|
|
|
|
|
hash_map[^] & hash_multimap[^]. You will find an example for using hash_multimap in the link provided. On similar lines you can use the key as const char*
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
1) I tried the below and got the error:
ommb.h(398) : error C2065: 'hash' : undeclared identifier
#include <hash_map>
#include //maha
using namespace std; //maha
using namespace stdext; //maha
struct eqstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) == 0;
}
};
typedef hash_multimap<const char*,="" int,="" hash<const="" char*="">, eqstr> map_type;
void lookup(const map_type& Map, const char* str)
{
cout << str << ": ";
pair<map_type::const_iterator, map_type::const_iterator=""> p =
Map.equal_range(str);
for (map_type::const_iterator i = p.first; i != p.second; ++i)
cout << (*i).second << " ";
cout << endl;
}
2) then i tried changing the type def to
typedef hash_multimap <const char*,="" ccommnode*,="" eqstr=""> test; and below is the error:
error C2903: 'rebind' : symbol is neither a class template nor a function template
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xhash(148) : see reference to class template instantiation 'stdext::_Hmap_traits<_Kty,_Ty,_Tr,_Alloc,_Mfl>' being compiled
with
[
_Kty=const char *,
_Ty=CCommNode *,
_Tr=functorHashString,
_Alloc=functorEqualStrings,
_Mfl=true
]
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\hash_map(182) : see reference to class template instantiation 'stdext::_Hash<_Traits>' being compiled
with
[
_Traits=stdext::_Hmap_traits<const char="" *,ccommnode="" *,functorhashstring,functorequalstrings,true="">
Can any please help me where i am going wrong.
Thanks,
Nandu
|
|
|
|
|
Hi,
How to split column header in different lines in list control?
Thanks
|
|
|
|
|
|
Hi all,
i want to write a program in which i want to establish connectivity with database(sql server 2005).
i am not getting where to start from, if anybody please provide me with some link our tutorials to start with... it will be of great help...
Thanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
See here[^],here[^] and here[^]
Also Please check Database[^] section of CP. There you will find plenty of articles about database connectivity.
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
|
I have a very basic question to ask. I'm not able to find out if the OnReceive() function of the CAsyncSocket class will always be called automatically when a message is sent by the client OR do we have to write code such that the function is called everytime a message is sent?
|
|
|
|
|
liz3 wrote: I'm not able to find out if the OnReceive() function of the CAsyncSocket class will always be called automatically when a message is sent by the client OR do we have to write code such that the function is called everytime a message is sent?
If you have established a connection with the client, the OnReceive() function will be called automtically called when the client sends you a message.
|
|
|
|
|
yes.. u r rite!!!
|
|
|
|
|
thankyou. But it is not called just the first time right?
I mean, client and server establish the connection, client sends a msg to the server. Then, the OnReceive() function is called. But after that, for subsequent msgs sent by the client, will the OnReceive() function be called automatically?
|
|
|
|
|
Yes see OnReceive() on MSDN[^]: Notifies this socket that there is data in the buffer for it to retrieve by calling Receive.
|
|
|
|
|