|
Semaphore is an synchronization element, like event, critical section or mutex - elements used in multithreaded programming. You can look to MSDN for detailed description (see CreateSemaphore function).
|
|
|
|
|
Yeah
That is a good idea
and also
note: there are many perfect articles in this site
Maybe that can help us to master "semaphore"
Thank you again!
|
|
|
|
|
Please Help!!!
It is necessary to turn DIB Bitmap on a corner of 90 and 180 degrees
|
|
|
|
|
you can use BitBlt to mirror a bitmap
Don't try it, just do it!
|
|
|
|
|
Hi
I heard a lot about accessing any computer if it is connected via the Internet. So I’m worry about the secret information in my computer ! especially when every one say that WinXP have more problem in Security !
Could any one tell me please how this is possible even if I did not make any share folder on my computer ?
Dose any one know a good articles about this subjects ?
Thanks very much
|
|
|
|
|
wrong section, doesn't have anything to do with visual c++!
Don't try it, just do it!
|
|
|
|
|
I actually use a CTreeView. The selection of HTREEITEMs is made with the mouse.
i want to fordid the use of the key-up, key-down, key-left and key-right which actually allow the selection in the Tree... if someone could hele me
Frackasse
|
|
|
|
|
Handle the TVN_KEYDOWN message.
Arjan.
|
|
|
|
|
Hi,
I created a resource-only Dll to store string, dialog, icon and bitmap. With loadstring function i can load a string from this dll, but i don't know how dipslay a dialog from it. here is my code :
UINT CDataResource::GetResourceDialog(int ResourceID)<br />
{<br />
LPCDLGTEMPLATE lpDialogTemplate = NULL;<br />
HGLOBAL hDialogTemplate = NULL;<br />
HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(ResourceID), RT_DIALOG);<br />
HRSRC hResource = ::FindResource(hInst, MAKEINTRESOURCE(ResourceID), RT_DIALOG);<br />
hDialogTemplate = LoadResource(hInst, hResource);<br />
if (hDialogTemplate != NULL)<br />
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);<br />
else<br />
return 0;<br />
<br />
ASSERT(lpDialogTemplate != NULL);
// HERE I WANT TO DISPLAY MY DIALOG
<br />
UnlockResource(hDialogTemplate);<br />
FreeResource(hDialogTemplate);<br />
<br />
<br />
<br />
<br />
return 1;<br />
}<br />
Thanks in advance
|
|
|
|
|
hm... It is about 4 years ago, that I did it...
I had the same ressource IDs in the main App AND in the DLL,
but in different languages.
I guess, you can do it like this:
HINSTANCE hDLL = AfxLoadLibrary("ress.dll");
HINSTANCE hRes = AfxGetRessourceHandle();
AfxSetRessourceHandle(hDLL);
//now do your dialog stuff..
AfxSetRessourceHandle(hRes);
AfxFreeLibrary(hDLL);
|
|
|
|
|
Cheickna wrote:
// HERE I WANT TO DISPLAY MY DIALOG
CYourDialogClass dlg;
dlg.InitModalIndirect(lpDialogTemplate);
dlg.DoModal(); Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi there
sorry for this question and dont kill me thanks
(at the moment i work on pocket pc - so there are missing some desktop mfc stuff - but i think its a generally c++ question)
i want to read a file line by line. is it a "good" way to read only once char at time and check for a \n? or is there are more "professional" way to do it?
e.g. this dummy code:
CFile file;
file.Open( L"\\file.txt", CFile::modeRead );
BYTE w[1];
CString s;
while( file.Read( &w, 1 ) != 0 )
{
if( w[ 0 ] == '\n' )
{
MessageBox( NULL, s, NULL, NULL );
s = "";
}
else
{
s.Insert( s.GetLength(), w[0] );
}
}
file.Close();
|
|
|
|
|
<br />
try<br />
{<br />
CStdioFile File("MyFile.txt",CFile::modeRead|CFile::typeText);<br />
<br />
CString strBuf;<br />
bool bNotEOF;<br />
<br />
bNotEOF = File.ReadString(strBuf);
<br />
while ( bNotEOF ) <br />
{<br />
bNotEOF = File.ReadString(strBuf);
}<br />
File.Close();
}<br />
catch(...)<br />
{<br />
::AfxMessageBox("some error");<br />
}<br />
<br />
hope this helps
|
|
|
|
|
i found a nearly similar code too ... but there is one problem:
error C2039: 'ReadString' : is not a member of 'CStdioFile'
on pocket pc the readstring method isnt available
also "getline" + some iostream functions are not available
|
|
|
|
|
If you look at the implementation of GetLine() of a similar function, you'll notice that it reads from the file character by character until EOF or '\n' is encountered! So what you can do is write your own getline .
Tip, one of the parameteres should be the length of the buffer you are putting the characters in, this helps avoiding problems.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
|
You could also try using fscanf, which includes a format parameter, and you can specify that the scan reads up to but not including a set of characters. (From memory, check the docs) ...
fscanf (fileptr, "%^['\n']s, &buf);
The format specifier is essentially %s, but in between the % and the s is the "up to but not including this list of chars ... the newline."
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hi
I've write some strings into the registry by using 'WriteProfileString()'.
Like this (in the registry):
MYPROGRAM
|
|-- EMPLOYEE
|
|
Name: Jens
Salary: 3Million Euro
Birthdate: .....
etc
Now i want to delete the entire section ("employee"). How can i achieve this?
Greetings
Jens
|
|
|
|
|
Search MSDN for RegDeleteKey
MS
|
|
|
|
|
I have recently had to work with the registry too, and I found that CodeProject has an entire section of articles about the registry. Using the list on the left, follow links through General/System/Registry.
I found that one of the easiest to do "simple" things was from Joseph Newcomer (http://www.codeproject.com/system/registry_class.asp[^]).
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Use CWinApp::DelRegTree. It will delete the key and all subkeys. Stay away from the roll-your-own registry solutions. CWinApp's have methods Get/Write for profile data and it can either be the registry or an .INI file.
|
|
|
|
|
Hi!
I am creating an application which connects to a ftp server and put a file on the server. When I press the send button it sends the file without problem but it seems to me like my application is freezed until the send operation is done! When I click on something on my program before the send operation is terminated my program just crashes down! This is the code I use:
--------------------
CInternetSession InternetSession;
CFtpConnection *m_pFtpConnection;
try
{
m_pFtpConnection = InternetSession.GetFtpConnection(m_serv, m_user, m_pass, INTERNET_INVALID_PORT_NUMBER, m_passsive);
}
catch ( CInternetException *pEx )
{
TCHAR szError [1024];
if ( pEx -> GetErrorMessage ( szError, 1024 ) )
AfxMessageBox ( szError );
else
AfxMessageBox ( "There was an exception." );
pEx -> Delete ();
m_pFtpConnection = NULL;
}
m_pFtpConnection->PutFile("...............", "............." );
if ( m_pFtpConnection != NULL )
{
m_pFtpConnection->Close ();
delete m_pFtpConnection;
}
---------------------------------------
How can I fix this?
Thank you for your future answers!
Well... I am a beginner ...
|
|
|
|
|
Scolinks wrote:
...my application is freezed until the send operation is done!
This is normal behavior. If you want your application to do other things while the file is being transaferred, but this code in a separate thread. Or you could use CFtpConnection::OpenFile() and CInternetFile::Write() to write the file in chunks, updating your UI in between.
|
|
|
|
|
Does anyone know how to implement the OnAfterPrint event in HTML? I'm using CHtmlView but can't see how to slot this in. Any help appreciated!
|
|
|
|
|
I'm working with ODBC and using *.mdb tables.
I wanna show one of tables on a dialog.
How can I do this?
emroz
|
|
|
|