|
Create and Initialize cretical section,create a bool bIsCanceled= FALSE
then Create a thread function .e.g. MyTHreadCheck() (use begin thread it does not leak memory like CreatThread()).
In the cancel button clicked function
Enter Cretical section and change the the bIsCanceled flag.
in MyTHreadCheck () loop for ever , inside this loop enter cretical section and check if bIsCanceled is TRUE , if so then close the port, exit cretical section and break Loop.
Hope that will help
Like some code ??
Regards
G. Alfadhly
<marquee>
Elementary my dear Watson! elementary!
|
|
|
|
|
good morning,
i have a problem: i have written a programm which manages MS ACCESS databases. on my computer i am the administator and all is working fine. but by autheor peoples where the administrator doesnt have rights to read and write we have problems. now we think we create there a new user an give them the rights to read and write.
now i would like to know how can i set a new user in MY MFC program ( the smae we will create on the computer form the other people) which isnt equal to administartor. that means i would like to set a different user from administrator in my MFC programm to read and write from MS ACCESS databaeses. i am working with DAO and under WIN NT
thank you
greetings
|
|
|
|
|
I'm using a Singleton class for some debugging work, and I have a few DLL's supporting my application. My problem is that I have a separate instance of the Singleton for each DLL and the Application. I would like them to all use the same instance of this variable.
Is there some shared memory trick or something that I can implement to get around this?
Thanks,
Jason
|
|
|
|
|
There is an article that will provide you with a work around for your problem.
hope it will help you
"HOWTO: Alternative Implementation of ATL Singleton"
The singleton implementation in this article works around this problem by returning a marshaled pointer in IClassFactory::CreateInstance().
Famous Last Words:
"TRUCK!!!"
|
|
|
|
|
I'm using a CDaoRecordset derived class to read a DAO Access database. The problem I have is reading Access2000 databases. VC6 does not seem to like Access2000 DAO databases. In order for it to read correctly I have to save the database as a "previous version" (Access97?). Any idea how I can read a DAO Access2000 database with VC6 please?
Thanks
|
|
|
|
|
|
Thanks. I've downloaded it, and will test it soon.
|
|
|
|
|
I've downloaded the MDAC stuff and I started by trying to open my Access2000 database. Simple I thought! All I want to do is open an .mdb file! The problem is I can't seem to work out what the correct connection string is. Microsoft's example is
_bstr_t strCnn("Provider=sqloledb;Data Source=MyServer;"
"Initial Catalog=pubs;User Id=sa;Password=;");
pConnection->Open(strCnn,"","",adConnectUnspecified);
I assume my data source is "MS Access Database". What does initial catalog mean? Some other examples show a server being specified. Well I just want the open the file! It might not be on a server...
Thanks for any help at all.
|
|
|
|
|
Try this one:
"DBQ=F:\dbpath\test.mdb;DefaultDir=F:\dbpath\;Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MS Access;;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;;"
it should work.
- Anders
|
|
|
|
|
Fantastic, thanks, it works!!!!!!!!!!!
|
|
|
|
|
Oops, I forgot... "initial catalog" is a database on a SQL Server...
- Anders
|
|
|
|
|
Hi,
I'm writing a simple chat app, and I'm using a RichEditCtrl as the display of the conversation. The problem I'm having is that I cannot seem to insert any text into the RichEdit. I've looked at the MFC help and it doesn't really mention anything about something as simple as inserting text. It does say use SetWindowText(), but that replaces whatever is in the control, which I don't want. The only other function that is related to my problem is the StreamIn(), but I cannot get that to work. I copy my message to pbBuff, but StreamIn() always returns as 0 chars read, or it will just keep on calling the callback function without ever stopping. I would appreciate any help on this, because I, surprisingly, cannot find information anywhere. Thanks.
Sriram
|
|
|
|
|
I figured out how to do it....I gotta say that Callback functions are a crappy way to insert text. Is it too hard to make a InsertText() function Microsoft??
Sriram
|
|
|
|
|
In true programmer fashion, you'd rather blame your tools than yourself.
There *IS* an InsertText function. It's called ReplaceSel() (or rather EM_REPLACESEL). If you read the docs, it says "If there is no current selection, the replacement text is inserted at the current location of the caret. "
|
|
|
|
|
How intuitive is a ReplaceSel() function compared to InsertSel()?? Give me a break. I, as a user, should not need to scour through the entire documentation to do something so inherent to RichEdit boxes. This is what I have to do to insert text at the end of the current text in the control:
int len = GetWindowTextLength()
SetSel(len,len);
ReplaceSel("whatever")
What I'm saying is this is far too much unecessary work to do something so simple. Besides, the documentation is not even clear about whether to do this or use the StreamIn() method. All I'm saying is that this can be far simpler than it is right now.
Sriram
|
|
|
|
|
How intuitive is a ReplaceSel() function compared to InsertText()?? Give me a break. I, as a user, should not need to scour through the entire documentation to do something so inherent to RichEdit boxes. This is what I have to do to insert text at the end of the current text in the control:
int len = GetWindowTextLength()
SetSel(len,len);
ReplaceSel("whatever")
What I'm saying is this is far too much unecessary work to do something so simple. Besides, the documentation is not even clear about whether to do this or use the StreamIn() method. All I'm saying is that this can be far simpler than it is right now.
Sriram
|
|
|
|
|
To me it's very intuitive. ReplaceSel with no selection inserts. What would you expect it to do when there is no selection (or more precisely, a selection of 0)?
Taking your example one step farther, why should it alway add text to the end when inserting text? What if you want it inserted at the beginning, or in the middle?
This is standard. Look at the C Runtime library, which forces you to seek in the file to the point you want to overwrite. There is no "Write to end of file" function.
Microsoft gives you the flexibility to do what you want. And yes, as a programmer you *SHOULD* be familiar with every word of the documentation for what you're working with. You don't have to remember it all, but you should be familiar with it and be able to find what you're looking for easily.
StreamIn is used for (not surprisingly) streaming data into the control from a file, not for general replacement or insertion of text.
|
|
|
|
|
Hi,
In our application we have the requirement that all edit boxes should have the data right-aligned. I have set the properties for the edit box reource as 'multi-line' and 'Alignment = Right'. The problem is that when I use the mentioned settings, the cursor becomes a thick line (Similar to the cursor observed in 'Notepad'). Is there any way in which Right-alignment can be obtained in Edit Boxes, retaining the normal thin line cursor?
Kindly let me know if there is a solution
Thanks,
Unnikrishnan Nair
|
|
|
|
|
HELP!
How do I hide the right-top toolbar of CFileDialog.
When I do:
CWnd* pWnd;
pWnd = GetParent()->GetDlgItem(lst2);
pWnd->ShowWindow(SW_HIDE);
I can instantly hide the Listcontrol in the CFileDialog but what's the
address of the toolbar
CWnd* pWnd;
pWnd = GetParent()->GetDlgItem(0x.???); // = the address I need, not
defined in dlgs.h
pWnd->ShowWindow(SW_HIDE);
Does anyone have any idea's?
|
|
|
|
|
I would like to create font in my native language to use it with msword. Is it possible in VC.
If so give me the guidelines
Advanced thanks
|
|
|
|
|
Goto www.microsoft.com/truetype to find information about TrueType fonts. You may find links to TrueType font editor programs too.
Make sure your native language is supported by UNICODE, then you can use GDI to display these characters. Otherwise, you may have to use glyph indexes directly.
www.fengyuan.com
|
|
|
|
|
If CF_UNICODETEXT is only available when performing clipboard operations under NT / 2000, is that saying that it's impossible to copy / paste Unicode characters under Windows 9x?
Is there any way around this, for instance, to copy / paste Cyrillic characters while under Windows 9x??? Or am I screwed completely?
Do these rules apply to MBCS too, can MBCS even display cyrillic characters???
Any help appreciated.
|
|
|
|
|
9x/Me only use Unicode in limited areas, like OLE/COM and FAT LFN filenames. If you want/need to put Unicode text on the clipboard, you'll need to compose the Unicode strings by hand.
You can do an ANSI-to-Unicode conversion on a Cyrillic string (with MultiByteToWideChar() ), but that only works if the system's current ANSI codepage supports those Cyrillic characters. With DBCS strings, you must be running a Japanese/Chinese/Korean language version of the OS, and you can only deal with strings in the same language as the OS. Non-DBCS languages of Windows do not handle DBCS strings.
--Mike--
http://home.inreach.com/mdunn/
Is history an illusion caused by the passage of time, or is time an illusion caused by the passage of history?
|
|
|
|
|
New to MFC, so if this is a simple question, don't nail me for it;
I have a CEdit-like control I wrote from scratch. Baring some niceties, it works okay. One thing that always
bugs me though, when I right click to get my context-menu, the cursor (IDC_BEAM) stays a beam. I want it to
be an arrow (IDC_ARROW) as per normal usage. The menu is defined only programatically, ie, not loaded from
a menu resource or the like:
inside my OnContextMenu() {
CMenu pop;
pop.CreatePopupMenu();
pop.AppendMenu(MF_STRING,ID_IMPEDIT_UNDO,"&Undo");
pop.AppendMenu(MF_SEPARATOR,0," ");
pop.AppendMenu(MF_STRING,ID_IMPEDIT_CUT,"Cu&t");
pop.AppendMenu(MF_STRING,ID_IMPEDIT_COPY,"&Copy");
pop.AppendMenu(MF_STRING,ID_IMPEDIT_PASTE,"&Paste");
pop.AppendMenu(MF_STRING,ID_IMPEDIT_DELETE,"&Delete");
pop.AppendMenu(MF_SEPARATOR,0," ");
pop.AppendMenu(MF_STRING,ID_IMPEDIT_SELECTALL,"&Select All");
> validation/etc snipped <
pop.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,
point.x, point.y, this, NULL);
pop.DestroyMenu();
}
So how do I change it's cursor to an arrow?
|
|
|
|
|
Hello,
Is there any way to invoke/run my .exe when user log in to the system, or when
system is rebooted. Is there any way to do this in VC++ / NT2000.
thanks in advance
|
|
|
|