|
Hi dear,
How can I change a directory security programmatically?
Thank you in advance.
|
|
|
|
|
:(I need to draw an icon using BitBlt function so to draw it within limited rectangle and I need the exact width and height of the icon. I noticed that if the icon is drawn using the standard colors, Ipicture.get_Width and Ipicture.get_Height will return the exact width and height of the icon, but if the icon is drawn using 265 colors, Ipicture.get_Width and Ipicture.get_Height will not return the correct values. What can I do to overcome this problem?
Julia
|
|
|
|
|
Does anyone know a product (free or not) like a C++/MFC library, ActiveX control, etc. that is a mathematical equation editor? I also need a mathematical expression evaluator. My problem is that I have a set of equations that have to be input in an MFC application. For this, I need an equation editor. Then, I need to evaluate the equations in a certain order that is why I need the expression evaluator. I will appreciate any help you can give me.
|
|
|
|
|
I've written a bunch of them. Currently I was working on one that would compile the expression into actual machine code so it would (hopefully) be able to evaluate the expressions faster (i.e, wouldn't have to traverse the parse tree each time). If you're interested, I might write an article on it.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
First of all, thanks for your help. As I understand you have written the lexer and parser for mathematical functions/expressions. I really would be interested in that. In my case, I don´t think machine code is necessary because the number of equations is not very high but if you have a lexer and parser and it works... then I am interested. Hope you have the time to write an article. I will also be interested in a graphical equation editor to make a nice GUI. Do you know any of this?
|
|
|
|
|
Yes, I have written the lexer and parser for the expressions. I've actually started working (just yesterday), on a new expression parser for a C++ preprocessor I'm working on. The new expression parser won't be recursive descent like my others, but will use operator precedence parsing. The current expression parsers that I have all use recursive descent techniques. I use the same lexer in either project (an almost complete C++ lexer I'm working on).
I had planned on writing a demo application with my article which would show graphs of equations, so it sounds like it's just what you are looking for (minus the machine code generation).
Anyways, if you are in a hurry to get some source code (don't want to wait for the article), I can package the lexer and expression parser up for you in a sample project. However, this wouldn't include any graphing abilities yet. Keep in mind, that I don't make any warranties concerning the software though. It's only been tested by me, and may (probably does) still have bugs in it.
Let me know what I shall do
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
As I see the problem, I can have a graphical equation editor as complex as is needed but the equation can be stored in any format I want. I will appreciate it if you can send me a project example. This way I can see if it is what I need. Of course, something like Mathematica (from the graphical point of view) would be great but in this case it is too much. I just need a nice GUI and an evaluator for the equations. In the problem, the result of evaluating an equation can be an input variable for another equation. If you want to write an article i guess i can wait another week or so. If you can send an example in advance, I will be able to check it and may be to give you some feedback or ideas for your article.
In any case, here are my thanks for your help.
Best Regards,
Miguel Segarra
|
|
|
|
|
The idea just came to me that you may be looking for something way more complicated than I originally had in mind. Are you looking for something like Mathematica[^], which will let you input and parse equations just like you would on paper? If so, I'm afraid I've mislead you. What I have written is something which will parse C/C++ style expressions. If this isn't what you are looking for, I'm sorry. If it is, however, then I'll be glad to help.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
I have an MDI MFC app where for "ease of use" I want the MDI child windows to stay maximized. When I create them, the frames are initially maximized (WS_MAXIMIZE is set as a style), and they have no minimize or maximize button.
So far so good, but when I use the "Windows" menu to switch between them, it insists on restoring all the MDI child frames.
I hacked around this by handling the OnMDIActivate, and if the frame is being activated, I do a ShowWindow(SW_MAXIMIZE).
Only problem is that this shows as a set of restored windows (as the other MDI children are repainted), and then the active window repaints itself maximized. This leaves a flickering effect on screen for around a quarter of a second
Is there a way I can suppress this?
Steve S
[This signature space available for rent]
|
|
|
|
|
You're must add red line
void CChildFrame::ActivateFrame(int nCmdShow)
{
<code>nCmdShow = SW_SHOWMAXIMIZED;</code>
CMDIChildWnd::ActivateFrame(nCmdShow);
}
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Thanks, Eugene, but that was the first thing I'd tried.
I still get the flashing effect. (Presumably it's something to do with the way the windows are being managed). I think I might be able to get around it by making the (other) frames invisible, rather than having them switched to restored size. It wouldn't be a problem, but one of the panes in the child frame is a form, and I don't want the user to have to scroll it, as there's no non-mouse interface to achieve that, and at least one of the users cannot use a mouse or pointing device.
Steve S
[This signature space available for rent]
|
|
|
|
|
Hi Steve,
This MDI behavior is a pain, and varies across Windows versions. The snippet below is what I do in ED (see sig) to try and handle this. Hope it helps.
CWnd* pMDIClient = NULL;
BOOL bMaximized;
pMF->MDIGetActive( &bMaximized );
if ( bMaximized )
{
pMDIClient = pMDIChild->GetParent();
pMDIClient->SetRedraw( FALSE );
}
pMF->MDIActivate( pMDIChild );
if ( bRestoreMinimized and pMDIChild->IsIconic() )
pMDIChild->MDIRestore();
if ( bMaximized )
{
pMDIClient->SetRedraw( TRUE );
pMDIClient->RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN );
}
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I have a thread handle,when the thread exit.the handle is invalid(0xfeeefeee).
and i want to clearly when is it valid and when is it invalid.
please show me a solution,thanks.
Scratch
|
|
|
|
|
A Thread handle IS valid even after the Thread exits. There is an error in your code that's corrupting the handle value.
But, answering your question: you can always call a harmless API function that needs a thread handle, say GetThreadPriority. If it returns ERROR_INVALID_HANDLE, you know the handle is invalid.
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
thank you for your help,but my code goes like:
In main thread.
<br />
if(m_pScanThread && m_pScanThread->m_hThread != NULL)<br />
{<br />
m_pScanThread->PostThreadMessage(UWM_TIMERON,0,0);<br />
}<br />
else<br />
{<br />
m_pScanThread = AfxBeginThread((AFX_THREADPROC)fnScanProc,NULL);<br />
if(m_pScanThread && m_pScanThread->m_hThread != NULL)<br />
m_pScanThread->PostThreadMessage(UWM_TIMERON,0,0);<br />
}<br />
Thread function.
<br />
CoInitializeEx(NULL,COINIT_MULTITHREADED );<br />
try<br />
{<br />
DWORD dwRet;<br />
MSG msg;<br />
while(dwRet = GetMessage(&msg,NULL,0,0) != 0)<br />
{<br />
if(dwRet == -1)<br />
{<br />
continue;<br />
}<br />
else<br />
{<br />
if(msg.message == UWM_TIMERON)<br />
Scan(...);<br />
else<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
}<br />
catch(...)<br />
{<br />
return -1;
::CoUninitialize();<br />
}<br />
::CoUninitialize();<br />
return 0;
Scratch
|
|
|
|
|
I never use MFC thread classes, for me they are just so much trouble for a simple _beginthread. But I'm sure that you can store the m_hThread in another variable just before the thread starts.
and, beware of this code:
m_pScanThread = AfxBeginThread((AFX_THREADPROC)fnScanProc,NULL);
if(m_pScanThread && m_pScanThread->m_hThread != NULL)
m_pScanThread->PostThreadMessage(UWM_TIMERON,0,0);
IIRC, you need a small Sleep or a Sleep(0) just after the AfxBeginThread for the other thread begin starting, otherwise in a 100% CPU machine you'll have problems.
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
Be warned!
Using ::BeginThread with mfc corupts the mfc state handling!
As far as I understand _beginthread is a wrapper for the Win32 API.
|
|
|
|
|
hi,
i want to know more detailed usage of CCriticalSection.
if i have a global CDatabase object. and, i used it to create a local instance of CRecordSet object in each thread.
do i need to Lock() the whole progress using CRecordSet or just the moment CDatabase be used by CRecordSet? you know, the CRecordSet used CDatabase when start the instance.
there is big diff. on the time holding the public resource, CDatabase.
anyone have any idea?
thanks,
jim
|
|
|
|
|
Hello,
i have an MDIChildWnd with StatusBar and Sizegripper.
I now want to change this resizable window into a non-resiable one, and vice versa. I removed WS_THICKFRAME from frame window. The window size is now fixed but the Statusbar don't get updated and the sizegipper is still shown. I tried a lot (e.g. invalidate, setwindowpos with SWP_FRAMECHANGE) to get it repainted correctly but it only works if i call the function twice (from menu or button).
Has anyone an idea how to change this dynamically.
Any help would be great
|
|
|
|
|
Hi all,
I am trying to create an XML file (containing Greek characters also) from within Visual C++ 6. The code is listed below:
FILE *v_myfile;
_TCHAR v_fileline[100];
_TCHAR v_filename[100];
swprintf(v_filename, _T("%s"), _T("myfile.xml"));
v_myfile=_wfopen(v_filename, _T("w"));
swprintf(v_fileline, _T("%s"), _T("<?xml version=\"1.0\" encoding=\"UNICODE\" ?>"));
fwrite(v_fileline, sizeof(_TCHAR), wcslen(v_fileline), v_myfile);
swprintf(v_fileline, _T("%s"), _T("<Mytag>some text</Mytag>"));
fwrite(v_fileline, sizeof(_TCHAR), wcslen(v_fileline), v_myfile);
....... similar writes to the file and finally..
fclose(v_myfile);
Well, the file is created and I am able to view it using the notepad. However, when I am trying to open it using Internet Explorer I am getting an error related to an invalid character at position 2, line 1 (at the "<" character).
If I open the file with notepad and then save the file WITHOUT making any changes (notepad automatically suggests that I save it as UNICODE), the Internet Explorer is then able to read the file correctly .
Before I save it using notepad, the length of the file is 752 bytes. After I save it, the length is 754. I guess that these two bytes make the difference.
Anybody have any idea about what is happening?
also, instead of "UNICODE" at the "<?xml....." line I have tried to put "UTF-8", "UTF-16" without any success.
I thank you in advance,
Christos P.
p.s. I have defined _UNICODE at the project setting.
|
|
|
|
|
If I remember right there are two bytes at the beginning of every Unicode
text file. Just copy the two first bytes of the "correct file" in front of Your file and all will be fine.
|
|
|
|
|
Thank you for your reply Alois, but I want to create the file at runtime.
Regards,
Christos P.
|
|
|
|
|
These two bytes will always be the same once You know them. Just prepend them.
|
|
|
|
|
All unicode text files must begin with the Unicode char 0xFEFF
eperales
|
|
|
|
|
I have a big problem with my MFC PocketPC application!
I have a simple SDI (single document) application, and two command bars on top of my application.
It works very fine, but when I open a dialog (let's say the "Open File..." dialog") and I invoke any one of the SIP components, i.e. the Keyboard and then close the dialog (the Keyboard is visible when I click the "Close" button of my dialog) I will see the view of my application, but the command bars are missing! It look like, that the view resized to the whole area and the command bars are moved outside the screen, so that the command bars are not vissible!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|