|
I have a code snippet that just doesn't seem to work on 2 NT4 machines here(Win2K/98 are fine).
Here's the code:
PRINTDLG pdlg;
ZeroMemory(&pdlg, sizeof(PRINTDLG));
pdlg.lStructSize=(DWORD)sizeof(PRINTDLG);
BOOL bVal = AfxGetApp()->GetPrinterDeviceDefaults(&pdlg);
Even though both NT machines have default printers setup, bVal returns FALSE every time.
Any ideas?
|
|
|
|
|
i connect internet vs telephone line, so i have an ip address (in format of 111.111.111.111). but if i disconnect internet, i have nothing (ipconfig says nothing).
i think the number is related to my internet vender, possible related to my PC (adapter etc) also, maybe more.
i think if i change a vender or change a modem (or PC), the number must be changed.
do you kown story of the number?
thx
includeh10
|
|
|
|
|
if you dial up you will almost certainly get a temporary IP from one of the numbers your ISP has reserved. it isn't related at all to your PC or modem, but it is related to your vendor (ISP).
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
so u mean tomorrow the number will be diff from what in today? (i can't wait for tomorrow)
and, what do the 4 group nember stand for?
thx.
includeh10
|
|
|
|
|
hmm, I think you need some introduction book to TCP/IP. Maybe "TCP/IP for dummies" will do good to you. At least, I learn a lot from it.
As Chris has said, the IP address is assigned to you by your ISP. usually, your IP is a dynamic one. You don't need to wait for tomorrow, just connect again, and you'll find it's different. Yes, it is different every time. That's how ISP manages the IP address resource.
|
|
|
|
|
i remember i studied a master subject called 'network ...', but i returned all to my teacher. i really need a dummy book now, good suggestion.
thx
includeh10
|
|
|
|
|
includeh10 wrote:
but i returned all to my teacher.
yes, it happens all the time. I return everything to my teacher once the exam is over. No worry, just grab a dummy book and get refreshed.
|
|
|
|
|
includeh10 wrote:
Who is God for IP addresses?
ICANN
includeh10 wrote:
i think the number is related to my internet vender
It is. People and companies are assigned blocks of public IP addresses. You can safely use the IPs within your block(s).
includeh10 wrote:
possible related to my PC (adapter etc) also, maybe more.
Not really. Your adapter (a.k.a.; NIC) has a MAC (Media Access Control) address, which is supposed to be unique. Your IP address is combined with that to identify you on a network.
includeh10 wrote:
do you kown story of the number?
Could you rephrase the question?
Jeremy Falcon
Imputek
<nobr>"Life is too precious - don't waste it." - Norm Almond
|
|
|
|
|
Hi,
how can I get the width of some string for an specific font (GDI).
Like:
long GetWidthInPixels(char *string,HFONT font) //or DC
cannot find out anywhere
|
|
|
|
|
GetTextExtentPoint
includeh10
|
|
|
|
|
i need to update an app with CSplitterWnd in MDI child frame, i meet a very trick thing and can't find solution, please help.
code is very simple:
add a member var in ZMDIChildWnd (sub-class of CMDIChildWnd)
CSplitterWnd m_wndSplitter;
override:
BOOL ZMDIChildWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
return m_wndSplitter.Create( this,2,2,CSize( 10, 10 ),pContext );
}
that is all. code is standard no problem because i got it from visual book.
but problem is about cursor shape:
in dll (use MFC as dll) version, cursor is same as what in visual c++ enviorment (apears when sizing view), but in static library version (use MFC in static lib), the cursor changed to 2 arrays (OCR_SIZENS).
to find problem, i use vc wizard to re-create a blank MDI interface, with choose 'advance button' then select 'use CSplitterWnd'. this time, the cursor is correct in both dll and static version.
because both apps are blank now, i checked every line but can not find any different.
the app to be updated is very large, i don't want to copy all code to a blank one, but i must find solution to use right cursor.
i guess it something wrong in 'setting' ?
thx
includeh10
|
|
|
|
|
Does anyone knows a Funktion to change an icon of an file?
thanks Cyclops
|
|
|
|
|
icon is an icon resource inside the file, use update resource method to change the icon, u will do it.
includeh10
|
|
|
|
|
No, i want to change the icon of other programms with my programm.
eg. i want to change the word-symbol from word.exe to the icon of exel.exe
|
|
|
|
|
what are object oriented models? plz descipbe me in detail.
|
|
|
|
|
Hi all
How can i create shortcutto a paricular file using MFC
Thanks
Sudhakar
|
|
|
|
|
IShellLink* pShellLink = NULL;
hRes = ::CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, IID_IShellLink, (void**) &pShellLink);
if (SUCCEEDED(hRes))
{
if (SUCCEEDED(hRes = pShellLink->SetPath(sTarget)) &&
SUCCEEDED(hRes = pShellLink->SetArguments(sArguments)) &&
SUCCEEDED(hRes = pShellLink->SetWorkingDirectory(sWorkingDir)) &&
SUCCEEDED(hRes = pShellLink->SetShowCmd(nCmdShow)) &&
SUCCEEDED(hRes = pShellLink->SetDescription(pComment)))
{
IPersistFile* pPersistFile = NULL;
hRes = pShellLink->QueryInterface(IID_IPersistFile, (void**) &pPersistFile);
if (SUCCEEDED(hRes))
{
BSTR bstrTest = sLinkDesc.AllocSysString();
hRes = pPersistFile->Save(bstrTest, TRUE);
::SysFreeString(bstrTest);
pPersistFile->Release();
}
}
pShellLink->Release();
}
|
|
|
|
|
the coding is called 'COM', a microsoft doc says it is direction of windows, looks terrible.
native c functions are hidden behind those microsoft stadard lines.
includeh10
|
|
|
|
|
Any attempt to call MDIGetActive() in my CMDIFrameWnd derieved class fails (program crashes, no asserts reported).
Some details:
-app created with MFC app wizard (MDI application)
-I launch the application, press Ctrl+N to create a single MDI Child window and then select an option from menu that opens a dialog window.
-this dialog needs some data from active MDI child so i call GetProblemData member function from CMainFrame class.
-GetProblem data member function crashes when it calls MDIGetActive() (although at least one child frame is opened)
-No other actions are taken at that moment, just placing a simple call to MDIGetActive() fails.
Any ideas?
Thanks in advance.
Railgun is like a Gilette Mach 3 - it does the job with one, easy stroke.
|
|
|
|
|
Hello,
I am interested in porting a WinNT 4.0 application to WinCE. Before I begin the task, I wanted to confirm, if it were possible to do so, as I require to purchase a lot of equipment for the same.
The development, earlier, had been on Ms Visual Studio (C++) 6.0 Service Pack 4.0. The complete code is in C++ and GUI is in Visual C++ (MFC).
Kindly advice me with your experience on the same.
Thanking you in anticipation.
Regards,
Harpreet Singh Juneja
Tata Consultancy Services
D - 4, Sector - 3, Noida-201 301 (U.P.)
India
Tel: (+91-120) 453-1622/23/24/25/27 (Extn: 232/236)
Fax: (+91-120) 455-2313
|
|
|
|
|
It really depends.
We purchased an HP unit for our testing. We got the Embedded VC++ 3.0 from MS for $15 (also downloadable to MSDN members).
It is best to assume that much of your UI will have to change. WCE3.0 does support a reasonable version of MFC, but the size restrictions on the UI will require that all your dialogs and windows will probably require some retooling.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Hi,
I have a C API that I want to wrapp in C++.
The idea I have is to have a C++ Base Class and have the C API call virtual functions of the base class, then the derived class can customise these functions.
The only way i can think of doing this is to have a single global pointer to the base class and have the C code call the member functions of that global object. So before I can call certain functions linked to the C API I have to make sure this global pointer points to the right instantiation of the derived class...
Its not very elegant or clean, i was wondering if anybody had any better ideas.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Confused as to what you mean here:
1) You want a C++ class to wrap C functions. In this case, you dont need to do anything special
class MySleep
{
public:
void GoSleep (int x) { sleep (x);};
};
2) You want C functions to access C++ classes (callbacks, threads?)
If you can pass a parameter around then you can pass the 'this' pointer as a parameter to a static function which calls the appropriate virtual function of 'this'
class MyThread
{
public:
static void threadHelper (void *param);
virtual void onStart ();
};
void MyThread::threadHelper (void *param)
{
((MyThread *)param)->onStart ();
}
.
.
.
create_thread (MyThread::threadHelper, this);
There are undoubtedly many other ways of doing this as well
|
|
|
|
|
Thanks,
Yes it was section 2, I want the the C Functions to Call C++ Functions.
The problem is still that the C Functions need to know the 'this' parameter to pass to the static function, therefore you still have to specify a global variable for the C Functions to use.
I've now implemented a static member function that returns an instance of the derived class pointer in the base class. Its still not pretty since I still have to make sure the derived class sets that pointer to itself before the C Functions can call it, but its better than making sure a global pointer is set.
Cheers
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
It's still not completly clear what you try to achive.
You have C functions that need to call member functions of an object. Is their any special reason why this functions have to be C functions or you can not pass them the instance pointer of the object to call?
If the C function is a callback you want to redirect into a member function, you should take a look at this article[^].
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|