|
I have many shared printers on my windows network. I want to use the API function StartDoc to initialize a print job. How can I get to know the HDC of every printer I have access to. Thank you.
modified 9-Mar-17 17:22pm.
|
|
|
|
|
Hi all,
I'm working on an MFC based application dealing with EN_CHANGE events. In my program, the user has to enter a parameter in a Edit Box, that starts an events:
void CExcitaPage::OnEnChangeAmplitude()
{
//Event...
}
I need to disable this event to configure the program first. Does someone can help me?
NikoiD.
|
|
|
|
|
Are you saying that OnEnChangeAmplitude() is being called when the dialog is first displayed, rather than just when the user makes a change? If so, try:
class CExcitaPage : public CDialog
{
private:
bool m_bInitializing;
};
CExcitaPage::CExcitaPage()
{
m_bInitializing = true;
}
BOOL CExcitaPage::OnInitDialog()
{
CDialog::OnInitDialog();
m_Amplitude.SetWindow(...);
m_bInitializing = false;
return TRUE;
}
void CExcitaPage::OnEnChangeAmplitude()
{
if (! m_bInitializing)
{
}
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Use a flag that is set to false when your app starts and is set to true once your program is configured. Check this flag in the EN_CHANGE handler.
void CExcitaPage::OnEnChangeAmplitude()
{
if (m_bIsPageInitialized)
{
}
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Hi PJ Arends,
Thank you for your answer! I already tryed our solution, but for a reason that I can't determine, the program crashes because of the declaration of my variable. In the class related to my program's page, I declare as public variable:
<br />
public:<br />
int Configured;<br />
and then I initialize to zero this variable before the configuration. Afterthat I set the variable to one and check in in my handler like that:
<br />
<br />
void CExcitaPage::OnEnChangeAmplitude()<br />
{ <br />
if (Configured) <br />
{ <br />
}<br />
}<br />
When I try to close the program, I become a classic Debug Error, Damage Block...
Do you have an other idea?
Thank you in advance
NikoiD.
|
|
|
|
|
You obviously have other errors in your program. I use this technique frequently if no problems. The debugger's error messages will usually give you a clue as to where the error is, although some detective work may be necessary.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Hi,
I am trying to use 'LoadLibrary()' & 'GetProcAddress()' functions to call the following function :
'D3DXCreateTextureFromFile(...)'
Now, this function is typedefed in 'd3dx8tex.h' as
#ifdef UNICODE<br />
#define D3DXCreateTextureFromFile 3DXCreateTextureFromFileW<br />
#else<br />
#define D3DXCreateTextureFromFile 3DXCreateTextureFromFileA<br />
#endif
So I wrote the following piece of code in my prog hoping to get things running at runtime...
################################################<br />
<br />
.<br />
.<br />
.<br />
<br />
typedef HRESULT (WINAPI *PFTEXT) (LPDIRECT3DDEVICE8, LPCSTR,LPDIRECT3DTEXTURE8*);<br />
<br />
HINSTANCE hLib1;<br />
PFTEXT pfText1;<br />
<br />
hLib1 = LoadLibrary("D3D8.DLL");<br />
<br />
if(hLib1 == NULL)<br />
return false;<br />
<br />
pfText1 = (PFTEXT) GetProcAddress hLib1,"D3DXCreateTextureFromFileA");<br />
<br />
if(pfText1 == NULL)<br />
{<br />
FreeLibrary(hLib1);<br />
return false;<br />
}<br />
<br />
if(FAILED(pfText1( m_pD3DDevice,szTextureFilePath,&m_pTexture)))<br />
{<br />
FreeLibrary(hLib1);<br />
return false;<br />
}<br />
<br />
FreeLibrary(hLib1);<br />
return true;<br />
<br />
.<br />
.<br />
.<br />
<br />
################################################
though it seems a working code it is not running properly giving NULL in 'pfText1' ie the function is not getting located from DLL. Also i think ( ) that there is a problem in DLL itself ie i am not able to find out where this function is defined (in which DLL). Please help me get this thing to work...
thxx.
gogizmo
|
|
|
|
|
its easier to put into the include directive in afx.h
Its better to use apparently the AfxLoadLibrary
heres a link for load library
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_link_explicitly.asp[^]
save your self trouble and type
#include <D3DX8.h>
at the top. make sure in tools->options->projects you have the paths linked up.
Building and executing a D3D sample will let you know.
my 2 cents from my experience, but I am in know an expert at c++
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
has anyone seen code that finds mersenne prime numbers???
|
|
|
|
|
Google for the GIMPS project. I was going to refer you to the Mersenne site but it is currently down.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
how can i find out the information about my computers processor like - Manufacturer, Clock Speed etc.
|
|
|
|
|
Try the Win32_Processor WMI class.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
and...how do i do that.....im pretty new to c++
|
|
|
|
|
WMI is a tall order to tackle if you are not that familar with C++ and COM. You might want to use the performance counters first to get the feel of things. See my example here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
can i find out through code, the amout of processing power my application is using.
|
|
|
|
|
See if this helps.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
has anyone come across a matghematical equation or something similar which when executed on a computer takes a lot of time. something like umm....trying out all the possible combinations of a 14 character password.
|
|
|
|
|
uhm, this should do it
void main()
{
int i = 0;
while ( true )
{
i++;
}
}
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
not something so simple....id like something more complex
|
|
|
|
|
|
Hi,
I've got two Tab controls placed on one Dialog window. The first Tab control is always visible and has two tabs. When i click on the second tab I want to display second Tab control inside the first one. Unfortunately first Tab control covers the second one although i gave it the WS_EX_TRANSPARENT style. How can I solve the problem?
|
|
|
|
|
is it possible to use splitter windows in a non doc/view application? if anyone has made such an application, I'll highly appreciate if u could tell me how.
thanks a lot,
Ankur
|
|
|
|
|
Check out the class CSSplitter found here on CodeProject. I use it in an app that has a re-sizeable dialog as the main window. Just search for CSSplitter and it's the only hit you'll get. It works very well.
|
|
|
|
|
Hey. I'm attempting to "lock" a Microsoft Word document using a simple MFC application. I've been searching high and low for flags or functions I could use to effectively "lock" the document. By "lock" I would like to make it so it can never be editted again. I could settle for having it password protection and I could just generate a random password and throw that away. Does anyone have any ideas or clues to help me get started searching? Thanks!
|
|
|
|