|
In general it's probably a matter of preference. I would personally create a Static library with the Visual Studio Wizard and put your wizard/DB code in there. Then I would just include that library in whatever project I was using. The reason I choose this method is because I like to statically link things that I have control over. That is just my personal preference, though.
If you have questions about doing what I've suggested, let me know and I'll walk you through it. BTW, did you know that property sheets have a wizard mode? Would accomplish what you are wanting to do pretty easily. Something you may want to look into.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Whilst b is a nice option, it means a lot of extra work without much extra gain (unless a third party app is going to call your wizard).
I'd stick with a, you can always wrap it in a COM object later should the need arise.
Michael
Logic, my dear Zoe, merely enables one to be wrong with authority. - The Doctor
|
|
|
|
|
Thanks guys, I knew I should have stuck with my first instinct and you have confirmed that for me !!!!!!!!!
Nic
|
|
|
|
|
Hi all...
i'm trying to list the avalible trays for specifice printer. for that list i use combo box so the user can choose what tray he/she wants the printer to use to print.
so i search and only find setting landscape, paper before the printing.
but i found out about
Devicecapabilities(...) to get avalible tray (Word) array. then i can set the tray by using DEVMODE.dmDefaultSource .
so i code like this
<br />
void CSMPprojectDlg::ListTrays(CWordArray *traysArray)<br />
{<br />
int arrayLength = traysArray->GetSize();<br />
<br />
for(int i=0;i< arrayLength; i++)<br />
{<br />
WORD tray = traysArray->GetAt(i);<br />
m_FolderTrays.InsertString(i,(LPCTSTR)tray);<br />
m_FileTrays.InsertString(i,(LPCTSTR)tray);<br />
m_ErrorTrays.InsertString(i,(LPCTSTR)tray);<br />
}<br />
UpdateData(TRUE);<br />
}<br />
<br />
void CSMPprojectDlg::SetDefaultPrinter()<br />
{<br />
CPrintDialog dlg(FALSE);<br />
dlg.GetDefaults();<br />
defaultPrinter = dlg.GetPrinterDC();<br />
dcPrinter.Attach(defaultPrinter);<br />
<br />
if(theApp.my_DevMode !=NULL)<br />
::GlobalFree(theApp.my_DevMode);<br />
<br />
theApp.my_DevMode = dlg.m_pd.hDevMode;<br />
lp = (LPDEVMODE) ::GlobalLock(theApp.my_DevMode);<br />
ASSERT(lp);<br />
<br />
CString pDevice= dlg.GetDeviceName();
CString pPort= dlg.GetPortName();
LPTSTR pOutput;
if(DeviceCapabilities(pDevice,pPort,DC_BINS, pOutput,lp) != -1)<br />
{<br />
if(pOutput != 0)<br />
{<br />
ListTrays((CWordArray*)pOutput);
}<br />
}<br />
<br />
}<br />
does anyone of you have same problem?
can u give me sample code or link about it.
thanks
|
|
|
|
|
I have a file opened with ifstream and I need to get to the top of the file. Right now I close the file, then open it back up again but thats pretty inefficient. For some reason I remember doing file.seekg(0); at school, but that doesnt seem to work.
-Raffi
|
|
|
|
|
You might wanna do a file.clear() to clear the state. E.g the eof bit might have been set earlier.
|
|
|
|
|
Perfect, thanks
-Raffi Yet another example of my bad programming skills.
|
|
|
|
|
I am currently working on a system that uses an Access database to store a list of url's waiting to be processed. I need to be able to add to, and amend the database, and so, I have derived a class from the CRecordset class called CURLRecordset using the classwizard.
In my application, I can succesfully open a CDatabase object in order to connect to the database, but when it comes to opening the actual recordsets associated with it:
/*
CURLRecordset* unparsed_urls;
CDatabase* db;
CString sql;
*/
unparsed_urls = new ( CUnparsed ) ( db );
sql.Format ( "SELECT * FROM urls WHERE status = %d;", STATUS_NOT_CRAWLED );
unparsed_urls->Open ( CRecordset::snapshot, (LPCTSTR)sql );
I get the following exception:
"Invalid character value for cast specification on column number 2 (urladdress)"
I have traced the source of the exception to the final move() function call in the CRecordset class's Open() method, but I have no idea how to deal with it. My database schema is as follows:
TABLE urls =
(
long urlid (PRIMARY KEY)
VARCHAR(256) urladdress
long status
long level
long keywordid
long sourceid
)
The header file for the CURLRecordset class is as follows:
class CURLRecordset : public CRecordset
{
public:
CURLRecordset(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(CURLRecordset)
// Field/Param Data
//{{AFX_FIELD(CURLRecordset, CRecordset)
long m_keywordid;
long m_level;
long m_sourceid;
long m_status;
CString m_urladdress;
long m_urlid;
//}}AFX_FIELD
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CURLRecordset)
public:
virtual CString GetDefaultConnect(); // Default connection string
virtual CString GetDefaultSQL(); // Default SQL for Recordset
virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support
//}}AFX_VIRTUAL
// Implementation
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};
Any help will be greatly appreciated!
|
|
|
|
|
I think the problem may be in your DoFieldExchange() function...I can't think of anywhere else that the problem could be.
|
|
|
|
|
Hi guys, there's a nice article here on CP with a C++ implementation of the Blowfish algorithm for encrypting files. The examples given however are a bit simplistic and I can't seem to get it to encrypt a text file. Has anyone done that yet?
Senkwe
Just another wannabe code junky
|
|
|
|
|
0. initialize the cipher
1. open input file
2. open output file (binary mode)
3. while (you haven't read the whole input file)
3a. get a block of text from the input
3b. encrypt it
3c. write it
4. close both
the last block will probably require padding to the cipher's block size
-c
Cheap oil. It's worth it!
|
|
|
|
|
Chris Losinger wrote:
3a. get a block of text from the input
3b. encrypt it
3c. write it
You mean I should append each encrypted block of text to the output file?
Just another wannabe code junky
|
|
|
|
|
yes.
thought it's not so much "append" as it is "write". "append" implies the file already exists (and is closed) and you're going to add more to it after re-opening it.
but, the idea is to read, encrypt then write one block at a time.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Will do, thanks for the help Chris
Senkwe
Just another wannabe code junky
|
|
|
|
|
I put an OCX control window. I put an Edit box derived from CEDit. In Edit box, if I press backspace, message will not posted to my active edit box, instead goes to IE. Similarly, Arrow Keys, Home, End Messages are captured by IE. How this can be avoided? How I Edit smoothly?
|
|
|
|
|
I've created an ATL service which offers an interface. In a test program i successfuly get a pointer to the interface but i can't see the service among the listed ones in the "Services" application.
Do you know how could i bring the service in the list as i can manually start and stop it? What exactly means the post-build registering step?
rechi
|
|
|
|
|
You need to register the service.
<servicename> -service
By default ATL registers it as a local server using servicename /RegServer
|
|
|
|
|
Thanx!
One more question: i saw in ServiceMain this call: LogEvent(_T("Service stopped")); . Is it about a loggin' system? If true, where is the log file?
rechi
|
|
|
|
|
You can see these events in the Event Viewer under Administrative Tools on Window NT systems.
Michael
"Eureka" is Greek for "This bath is too hot"
|
|
|
|
|
Hi all, I'm using DirectX and am trying to see whether my graphics card can use the IID_IDirect3DTnLHalDevice ref before committing my application to it (where a nasty fail would happen if it couldn't). I have used the EnumDevices Callback function to obtain a D3DEVICEDESC7 pointer containing information about my Graphics card and am trying to check the dwDevCaps variable for the D3DDEVCAPS_HWTRANSFORMANDLIGHT cap by using:
if (!(lpdEnumDevice->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT))
return Error;
lpdEnumDevice is the correct structure, but this test always returns false! I have tried using the IID_IDirect3DTnLHalDevice id at CreateDevice time and it works! so I know it must support it. What am I doing wrong? I have a nVidia GeForce 2 Ultra (Gainward spec) graphics card.
Oh and thanks for the response Mike but the D3DDEVCAPS_HWTRANSFORMANDLIGHT was introduced in version 7 of the DirectX SDK (according to Microsofts instructions), it has a DWORD value of 65536 whilst my dwDevCaps member variable has a value of 1361, which is obviously why it is returning false. But why is this value so low? Do I hav to call a GetCaps() function or something? or re-inialise the D3DEVICEDESC7 structure in the callback function somehow? The Microsoft SDK articles seem to suggest I'm doing it the right way (don't they???), but it still fails to succeed.
How do I even know if its trying to access my nVidia card?
Ta all,
Alan.
|
|
|
|
|
Well call me stupid! What I did was working all along! The thing is the EnumDevices callback function CYCLES through all the compatible devices on the system, one by one and applies each function test to each device. I had only debugged the initial function application which enumerates the RGB Software compatibility (hence the test failing). Upon pressing ctrl + F10 the callback tests the next device available, the HAL, and by pressing ctrl + F10 again it tests the TnLHAL, which is the device I wish to use. If the system graphics card does not cater for transforms and lighting, the EnumDevices function will never enumerate this device and so never return true to the test I mentioned earlier. Hope this helps anyone out there with the same problem.
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Is there a function similar to BitBlt which can be used to take a DIB Bitmap in memory and draw it to device context flipped horizontally or vertically?
|
|
|
|
|
no, i don't think there is.
-c
Cheap oil. It's worth it!
|
|
|
|
|
No, but if you pass reversed co-ordinates to BitBlt, you'll get the result you are after.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
example please
edit
ahh... not BitBlt like you said, but StretchBlt, like he said. it all makes sense now.
-c
Cheap oil. It's worth it!
|
|
|
|