|
hope these links will help..
http://www.codeguru.com/mfc_database/querydef.shtml
http://www.codeproject.com/useritems/ADOClasses.asp
http://www.codeguru.com/mfc_database/
http://freespace.virgin.net/paul.maker/examples.htm
cheers..
Himanshu
|
|
|
|
|
Those links helped me to realize I can do what I need via SQL and the database connection. Not exactly how I wanted to do it, but since I can't quite get down the method using the AddNew() and the other, I will use SQL until I can find a precise example of what I need. thank you much for the links though.
The wisest of the wise may err. - Aeschylus
|
|
|
|
|
Hi,
A have a CPropertySheet with more pages. It's a wizard. I don't use the default buttons (next, back, finish). Each page has it's buttons. I have a "Cancel" button and I'm trying to end the sheet when this button it is pressed but I don't seem to realize that.
The closest thing was this:
CPropertySheet* sheet = (CPropertySheet*) GetParent();
CPropertyPage::OnWizardFinish();
sheet->EndDialog(1);
which destroyed the page but the dialog frame remained.
Do you have some suggestions? Thanks.
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Try calling OnOK on your sheet pointer, or posting a WM_CLOSE message.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I've tried with OnOK(), OnCancel and still nothing happens.
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
What about posting WM_CLOSE ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I will try now. But I think I just realised why I have this problem. I have a dialog and in the OnInitDialog method I create a CPropertySheet. And I was trying to cancel the main dialog and not the propertysheet.
Thanks for the help!
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Hi everyone,
I want to add text to a editcontrol from a file but the text is inserted in one line.How can i add lines in the editcontrol so the text has the same format as in the text file;
|
|
|
|
|
Try replacing "\n" s with "\r\n" s.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
first of all, I do this in pure API, but it's all wrapped up in MFC so you shouldn't really have any problems
I need to upload some memory data to ftp. I open the internet and connect (InternetOpen, InternetConnect), I open a ftp file using FtpOpenFile... so far I guess it's all right, no errors, FTP server's log looks quite okay. (btw. I do with GENERIC_WRITE).
Then I try to upload data using InternetWriteFile(handle_from_ftpopenfile, buffer, length_of_the_buffer, &written);
the problem is that when I walk thru the code or call sleep to suspend the thread before calling the InternetCloseHandle for a while (which is weird. It shouldn't do anything then unless it uploads in a separate thread, but what that written parameter is for then?) the file uploads okay. If I just run it, the file is created but is empty (0 bytes).
In both cases the InternetWriteFile returns false, GetLastError is 0, InternetGetLastResponseInfo is 0 (and error buffer is "").
I guess the cause might be the InternetCloseHandle (I've read somewhere that it cancels the operations pending. But the InternetWriteFile should be synchronous, or not?). So what's up and how can I determine when it's safe to call InternetCloseHandle...
|
|
|
|
|
I am using CDatabase and I want to be able to open the database without the user having to select anything. (Users like to break stuff, I want no breaking) I can get it so I just have to select the database with this code:
dbSNDB.OpenEx("DSN=MS Access Database,", 0);
And I am wondering if there is anything I can do to make it so it open's the database automtically. I am still having to select the database from the options it pops up.
Thanks
The wisest of the wise may err. - Aeschylus
|
|
|
|
|
If there's only one database you can do this:
bd.Open(_T("Your-DSN"),FALSE, FALSE, _T("ODBC;UID=yourUserName;PWD=yourPass;Database=yourDb"));
if (bd.IsOpen())
// it's ok
else {
// error
}
If you want the user to select a database you can let him choose from a list (but not the one opened by ODBC). Then you try to open the connection with the database selected by the user with the code above. If there's any error you display an error message.
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
I've tried this both with VC6 on one machine, and imported the project to VC7 on another. It worked on neither. Try the code below. After running OnWriteOut(), right click on the file in the shell, click on "Properties", and go to the "Summary" tab. Viola! Here, I'm getting only some "default" properties, and the application name ("The Application v 1.0") doesn't show up anywhere! However, if you copy the SAME FILE over to a Win2k machine, it shows up fine. You'll notice that if you set a breakpoint in OnReadIn() after the ReadMultiple call however, all the properties (including app name) come in just fine programmtically. Am I doing something wrong here? If this is confirmed, how do I report this to MS?
P.S. This is in SP1, and I'm looking at the "Advanced" view of the Summary
---------
Code
---------
void CTestwritepropsDlg::OnWriteOut()
{
HRESULT hr = S_OK;
IStorage* pStg = NULL;
hr = ::StgCreateStorageEx(CComBSTR("C:\\out.test"),
STGM_CREATE | STGM_READWRITE | STGM_TRANSACTED,
STGFMT_DOCFILE, 0,
NULL, NULL, IID_IStorage, (void**)&pStg);
ASSERT(SUCCEEDED(hr));
IPropertySetStorage* pPropSet = NULL;
hr = pStg->QueryInterface(IID_IPropertySetStorage, (void**)&pPropSet);
ASSERT(SUCCEEDED(hr));
IPropertyStorage* pProps = NULL;
hr = pPropSet->Create(FMTID_SummaryInformation, NULL, 0,
STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
&pProps);
ASSERT(SUCCEEDED(hr));
PROPSPEC specs[] = {{PRSPEC_PROPID, PIDSI_APPNAME},
{PRSPEC_PROPID, PIDSI_COMMENTS},
{PRSPEC_PROPID, PIDSI_TITLE},
{PRSPEC_PROPID, PIDSI_AUTHOR} };
PROPVARIANT vars[4];
PROPVARIANT var;
PropVariantInit(&var);
var.vt = VT_LPSTR;
var.pszVal = "The Application v 1.0";
vars[0] = var;
var.pszVal = "Some comments";
vars[1] = var;
var.pszVal = "The Title of the Document";
vars[2] = var;
var.pszVal = "Bill Gates";
vars[3] = var;
hr = pProps->WriteMultiple(4, specs, vars, 0);
ASSERT(SUCCEEDED(hr));
hr = pProps->Commit(STGC_DEFAULT);
ASSERT(SUCCEEDED(hr));
pProps->Release();
pPropSet->Release();
hr = pStg->Commit(STGC_DEFAULT);
ASSERT(SUCCEEDED(hr));
pStg->Release();
}
void CTestwritepropsDlg::OnReadIn()
{
HRESULT hr = S_OK;
IStorage* pStg = NULL;
hr = ::StgOpenStorageEx(CComBSTR("C:\\out.test"),
STGM_READWRITE | STGM_TRANSACTED,
STGFMT_DOCFILE, 0,
NULL, NULL, IID_IStorage, (void**)&pStg);
ASSERT(SUCCEEDED(hr));
IPropertySetStorage* pPropSet = NULL;
hr = pStg->QueryInterface(IID_IPropertySetStorage, (void**)&pPropSet);
ASSERT(SUCCEEDED(hr));
IPropertyStorage* pProps = NULL;
hr = pPropSet->Open(FMTID_SummaryInformation,
STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
&pProps);
ASSERT(SUCCEEDED(hr));
PROPSPEC specs[] = {{PRSPEC_PROPID, PIDSI_APPNAME},
{PRSPEC_PROPID, PIDSI_COMMENTS},
{PRSPEC_PROPID, PIDSI_TITLE},
{PRSPEC_PROPID, PIDSI_AUTHOR} };
PROPVARIANT vars[4];
hr = pProps->ReadMultiple(4, specs, vars);
ASSERT(SUCCEEDED(hr));
pProps->Release();
pPropSet->Release();
hr = pStg->Commit(STGC_DEFAULT);
ASSERT(SUCCEEDED(hr));
pStg->Release();
}
|
|
|
|
|
hi. i am working on a MFC SDI project. i use below code for changing the cursor.
HCURSOR cur;<br />
cur=AfxGetApp()->LoadStandardCursor(IDC_IBEAM);<br />
SetCursor(cur);
but it don't work. my cursor is not Static. for example i write this code in OnLButtenDown function. even i change the cursor with a left-Click then a moment later it changes to default cursor (IDC_ARROW).
if i write the code in OnMouseMove and then i move the mouse over the main window the Cursor will flicker and will change to my cursor and then will change to Defualt cursor and even i stop moving the mouse it will became default mouse cursor
what can i do to Creat a Static Cursor in a SDI ?
|
|
|
|
|
You need to handle the WM_SETCURSOR message. Windows sends this to your window everytime the mouse is moved - that is why your cursor changes back almost straight away.
Dave
|
|
|
|
|
SetCursor is trick: u must call it from a window, and the window must have focus first (or WM_SETFOCUS message is on first).
includeh10
|
|
|
|
|
I am new to working with bitmaps and other images
Where can I find a table for colors in hex?
or can some explain to me this bit of code
<br />
my_cdc->SetBkColor(RGB(0xFF,0x00,0xFF));<br />
<br />
what is the 0xFF,0x00,0xFF?
I am trying to set a color in a bitmap image to be transparent but am having trouble understanding
Thanks
Later,
JoeSox
www.joeswammi.com
"Male Employee #1 Hey Nick, how's it going?
Nick Burns: Oh great, really great. I love teaching people remedial computers here. You guys should be wearing helmets or something?"
|
|
|
|
|
Hi..
colours of pixels are mixtures of three basic colours:
Red,Green,Blue..
The final colour is the resultant of mixing the three basic colours..
I f you want to increase the red component you can increase its value in the macro RGB(Red,Green,Blue)
each component takes a value from 0 to 255 in decimal..
00xFF (hex)= 255(dec)<br />
00X00(hex)= 0 (dec)
so the resultant colour in you example will be a mixture of red and blue only..
I wish this brief explanation can spot some light !!
|
|
|
|
|
so this:
<br />
RGB(0xFF,0x00,0xFF)<br />
is the same as:
<br />
RGB(255,0,255)<br />
why would some one use RGB(0xFF,0x00,0xFF)
instead of RGB(255,0,255)?
|
|
|
|
|
JoeSox wrote:
Where can I find a table for colors in hex?
You do not need to supply the rgb values in hex.
Using MS Paint you can get the rgb value to use in your app.
Paul
|
|
|
|
|
ah, thank you!!
Later,
JoeSox
|
|
|
|
|
|
Hi All,
I just wanted to get some opinions on the best and/or simplest way to access a MS Access DB using VC++ without MFC.
Thanks,
Paul
|
|
|
|
|
OLEDB using ATL support classes (CSession, CCommand and so on).
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
Hello everyone, i have a small problem trying to guess how to add a small icon in listbox.
I am pure API programmer so i think there may be some problems with that (?)
I just set a text on index 1 in listbox, and also i would like to put beside the text a small icon
representing some action.
Please help me to solve it..
|
|
|
|
|