|
Hi Ravi,
You are absolutely right!
I want to implement the latter part.I have some controls in a dialog and those need to be displayed on the form.As iam new to programming i could not understand where to set the Parent for the dialog.I've used Setparent() function, but its not working.
Thank You for ur suggestion.
|
|
|
|
|
The modeless dialog's parent gets set on creation. Declare an instance of the modeless dialog as a member of your formview. Then, in response to the button click, do this:
VERIFY (m_dlgModeless.Create (IDD_MODELESS, this));
m_dlgModeless.MoveWindow (...);
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Create a place holder using a staticrect on the form where you want the dialog box to appear.
Remove the titlebar of the dialog box.
when you click on the button, create the dialogbox as modeless and using the rectangle area of the static rect move the dialogbox into that area using MoveWindow
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hi,
I want to make simple program to get printerstatus from assembly language.
From New project, i choose win32 console application - empty application.
But, when i put this code to empty source file (.cpp)
void main()
{
unsigned char iRetVal = 0;
__asm
{
mov ah, 02h
mov dx, 0 /* 0 is number for LPT1: */
int 17h
mov iRetVal, ah
}
if (iRetVal == 0x90)
cout<<"success"<
|
|
|
|
|
what Os are you using?
NT, 200, xp will not allow you to access the hardware directly.
tcss
|
|
|
|
|
You must be run only on Win95/98
for WinNt/2x/Xp/03 you must know kernal programming for accessing the ports and other stuff..
regards
Balkrihna Talele
|
|
|
|
|
I can't remember where offhand, but there are some libraries around that let you access the printer port undert NT/2000/XP.
Elaine
The tigress is here
|
|
|
|
|
Others have already explained why the HAL is blocking access to the printer port. I would like to point out that you can keep your program from outright crashing by using a try/catch block. Something like:
void main( void )
{
unsigned char iRetVal = 0;
try
{
__asm
{
mov ah, 02h
mov dx, 0
int 17h
mov iRetVal, ah
}
if (iRetVal == 0x90)
printf("success\n");
else
printf("failed\n");
}
catch(...)
{
printf("exception\n");
}
} This doesn't help with the port access, but does give you control over the previously unhandled exception.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi All,
Thank You.
Because I use win2000 it doesn't work and when I try in win98, it works fine.
I think this topic can be close now.
|
|
|
|
|
Hi,
I am using VC+ 7.0, how can i add an image in dialogbox(MFC Dialog based appln) which will appear in starting of the application as background for that window. How can we add controls on that window.
Thank you........
|
|
|
|
|
There are couple of ways , doing this easiest way is to just use Picture control , availabe in control toolbar , other solutions might to use statndard GDI Api's such as BitBlt m StrtchBlt for reference u can visit Bitmap section of codeproject.
Unmanaged in a .NET world
|
|
|
|
|
hello there ..
there is a slight problem that i am facing with strings greater then 32k
i have a variant bstr containing a string which is greater then 32ks..
1. how do i store this thing? into a buffer?, but then how do i get the size of the bstr string so that i can create a buf of that size?
2. how do i truncate this bstr string into strings of sizes 32ks?
thanks for the time
regards
|
|
|
|
|
safeeullah wrote:
1. how do i store this thing? into a buffer?, but then how do i get the size of the bstr string so that i can create a buf of that size?
Why are you wanting to store something that is already stored? If the bstr variable already holds the data, why are you wanting to create another variable to hold that same data?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
yes i have it in a bstr...now i need to break that string into 32k segments..for further manipulations..
how to do it?
regards
safee
|
|
|
|
|
Something like this, maybe:
BSTR b = SysAllocString(_T("This is a 32k string"));
TCHAR left[11],
right[11];
_tcsncpy(left, b, 10);
left[10] = '\0';
_tcsncpy(right, b + 10, 10);
right[10] = '\0';
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
beter to store that much in file.....
read from a file.
|
|
|
|
|
Curious, does anyone have a link to how to make a simple Single Document Application Database using mfc? After doing some reading I see that I use CObject and CArchive however I'm kinda clueless of what to do from there. A good commented example would be great. All i want to do is have a form view to fill in a few edit boxes then it search the database (file i make) and spit out the results.
Thanks,
Ps. Anything other than the msdn site will get great the msdn site seems to far fetched.
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
This isn't going to be an MFC "purist's" response.
These steps are simply the simplest ways to get a database thing going.
They do not rely on the App Wizard to do anything. They do not tie member variables to data fields.
To access a database that has an ODBC mapping to it, do the following:
1) #include <afxdb.h> in your source file
2) To pull records from your database, do the following:
<br />
CDatabase db;<br />
db.OpenEx("XXX-ODBC DATASOURCE MAPPING NAME GOES HERE-XXX");<br />
CRecordset rs(&db);<br />
CString QueryString;<br />
CString data;
<br />
QueryString = "SELECT * FROM tablename";
<br />
rs.Open(AFX_DB_USE_DEFAULT_TYPE, QueryString);<br />
<br />
while(! rs.IsEOF())<br />
{<br />
rs.GetFieldValue("FieldName", data);
rs.MoveNext();
<br />
}<br />
<br />
rs.Close();<br />
db.Close();<br />
I'm going to live forever or die trying Rangers Lead The Way
|
|
|
|
|
Isn't 'MFC purist' an oxymoron?
Steve S
|
|
|
|
|
i want to make my own multi-thread socket classes (really really simple ones, so i can use them in my small games and such, and just to learn)
i want to create a thread that will call select() and will allow for me to wait for feedback on a set of sockets
however, i want to interrupt select() so that i can add sockets to the select list when the user calls AddSocket()
how would i do that? i dont want to forcefully end the thread, nor do i want to create a thread per-socket
hmm?
r -€
|
|
|
|
|
Well, I don't think you can interrupt select. But, if you want to start a thread to respond to socket events on a set of sockets, you may consider calling WSAEventSelect instead. Associate an event handle with each socket, register for events you are interested in with WSAEventSelect for each socket, then to wait for the events, call WSAWaitFormultipleEvents. The thing about this is that the array of event handles can include other events besides socket events. So, maybe the 0th event handle could be an event that another thread could use to signal the thread that is waiting for the sockets to do something else, like shutdown, or whatever else.
|
|
|
|
|
I'm trying to use this function, but my debugger doesn't recognize it. Is there something I need to define or add to my stdafx? Or, is there a better way to find out the name of the SQL server if it isn't local?
halblonious
|
|
|
|
|
halblonious wrote:
Or, is there a better way to find out the name of the SQL server if it isn't local?
ummmmm i think u have to write code to do that ... ive not heard of such a debug function?
"there is no spoon" biz stuff about me
|
|
|
|
|
Are you getting a compiler, linker, or runtime error? If it's a compiler error, be sure to include Sqlfront.h and Sqldb.h. If it's a linker error, be sure to link with Ntwdblib.lib.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks, that did seem to work. The sweet irony is, though, that the Sqlfront.h has a compiler error itself:
Compiling...
testLibraryDlg.cpp
c:\program files\microsoft visual studio\vc98\include\sqlfront.h(126) : error C2146: syntax error : missing ';' before identifier 'LPINT'
c:\program files\microsoft visual studio\vc98\include\sqlfront.h(126) : error C2040: 'PTR' : 'int' differs in levels of indirection from 'void *'
c:\program files\microsoft visual studio\vc98\include\sqlfront.h(126) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
I'm trying to use SQLBrowseConnect to connect to an unknown server name now, but I'm having even less luck with that. I cut and pasted the example in the MSDN help, but it's got it's own compile errors.
halblonious
|
|
|
|