|
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I've seen a number of apps lately that have a tab control in the About dialog. At least one of the tabs will have links to email and check for updates. I know how to add a tab control but I thought for the About dialog to use links, it had to be derived from CDHtmlDialog? That's what I use to create mine so that I can have such links but when I try adding a tab control to it, the tab control is layered on top of the html section so that they are two different dialogs. Does anyone know how to do this or where I can find an example?
Jack
|
|
|
|
|
I have written an app in VB and am trying to rewrite it in VC++. What the app does is work with large text files(up to 30 meg) containing code to drive CNC machines. I ran the wizard to create an exe, I changed the base class to CRichEditView. I added the line CRichEditDoc::m_bRTF = FALSE; to allow it to work with plain text.
I built the base project in release and ran it. The load time for a sample 16.7 meg file is 4 times greater in the VC++ version than it is in the VB version.
Does anyone have any ideas what I'm doing wrong?
Thanks
Bryan
|
|
|
|
|
bgm56 wrote:
Does anyone have any ideas what I'm doing wrong?
Perhaps you are doing nothing wrong. Comparing the running time of a VB application to a VC++ application is not a very fruitful exercise as they are two very different development platforms. Each language has its own strengths and weaknesses, not to mention that each is a different distance away from the underlying machine code depending on what is happening at any given moment.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for the reply.
The intent is not to evaluate which code runs quicker. I noticed the problem when I created the exe and tested the function. The load time was unacceptably long. This is my first C++ project and I'm trying to learn to make it work better than the standard MFC wizard.
I have commercial apps that do similar things that load 50% faster than my VB code and were written in C++, so I know it's possible.
Thanks
Bryan
|
|
|
|
|
bgm56 wrote:
The load time was unacceptably long
Without actually seeing how you are loading the file, it's hard to offer any suggestions.
bgm56 wrote:
I have commercial apps that do similar things that load 50% faster
Perhaps you meant 150% faster. 50% implies twice as long or half as fast.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Again, thanks for the reply.
I guess it's time to pick up some books on MFC and read them instead of this message board. I did try to take a short cut and find someone that knew MFC inside out and give me a quick answer, hard work and study will be the correct answer.
You have helped me though, reaffirmed some long known truths, advice is worth exactly what you pay for it and now matter where you go there are people trying to boost their ego by taking cheap shots at you.
So thanks for the tips. Imagine that, comparing run times between programming languages is fruitless, dang could have knocked me over with a feather when I read that.
50% faster really means slower. Guess technically you are correct, thank you for pointing out the error of my ways.
By the way I sure hope you don't by any products offering you 50% more for free, I'm sure they are trying to screw you. Guess I'm not the only person in this world who uses percentages loosely.
Thanks for making my first post to any such board so informative, it will be my last.
|
|
|
|
|
bgm56 wrote:
I guess it's time to pick up some books on MFC and read them instead of this message board. I did try to take a short cut and find someone that knew MFC inside out...
That's not taking a shortcut. That's just being resourceful.
bgm56 wrote:
...advice is worth exactly what you pay for it...
Which says a lot since this is a free site!
bgm56 wrote:
Thanks...
You are very welcome!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Don't sweat it.
Everybody occasionally tries to take a shortcut and everybody asks "a stupid question". But a stupid answer is just that - sheer stupidity.
The 150% statement is not even technically correct, because you were referring to a differential value, not an absolute value.
50% faster means exactly that, because it is a relative to another speed:
Baseline speed of old app = 1
Baseline speed of new app = 1.5 * baseline speed of old app
Relative %Speed increase = ((1.5 - 1)/1)*100% = 50% *relative* increase in speed = "50% faster".
It is a simple engineering calculation.
But it's no surprise that people can't get it right, because the term "software engineering" itself is a joke. I was trained as a chemical engineer. The cornerstone of ALL engineering fields are definition of standards and application of those standards in practice and especially carefully precise and complete documentation of all aspects of engineering a process.
OTOH, software "engineers" still argue over whether they should have to comment their programs.
Now ... having gotten the (un)cordialities out of the way ... (and no I don't care if that's not even a word and I still misspelled it, LOL)
As to your observation that commercial projects load much faster, I can give you a general answer of one possible reason why that is the case.
Disk operations are slow (relatively speaking, LOL). If you are talking about very large text files being loaded into a rich textbox, my guess would be that most likely what your competitors are doing is loading only a percentage of the total file from disk into memory, then displaying the textbox. Your application is now "loaded" so to speak, displays text, and responds to user interaction.
Meanwhile a background worker thread continues the process of loading the rest of the file from disk.
I can't give you a quick and easy solution on how to do this.
And yes definitely pick up a good resource or two. Maybe try one of Jeffrey Richter's Win32 Programming books - the solution you are looking for is probably less a function of MFC and more of a function of core Windows behavior - threads, memory, disk operations etc.
However I can point you in at least one direction.
Look into Win32 Shared Memory Mapped Files.
They allow threads to read from and write to a common, shared memory space that has been allocated using virtual memory. It requires a little bit of thread synchronization, but in a pretty simple fashion using mutexes and semaphores.
It provides you with a reliable technique to load, say 10% of the file from disk into memory, then into the rich textbox, start your app, and then allow a worker thread to read say, another 10% of the file from disk, then you synchronize and add the additional file data into the textbox, and so forth and so on until the entire file has been read.
Good Luck!
Robert
|
|
|
|
|
Hi,
Thanks for the reply. I have been studying what the problem might be. I have download many code samples to see how they load files and how they behave.
Here's what I found so far.
Using the computer I am writing the app to run on at work ( a Celeron 700), a straight app wizard generated MFC program opening the 16.7 meg text file using serialization takes 47 seconds to completely load the file into the Rich text control.
Using an example I found using the same rich edit control and loading the file through the API, the file loads in just slightly over 30 seconds. A very noticable improvement.
I then found some examples using the scintilla control, which does everything I need.
I found one example using scintilla and MFC and another using it and API. The MFC version opened the file in 15 seconds while the API version opened it in 13. However the API sample did not support MDI so I think the 2 seconds is a good trade.
Thank you for your help and suggestions.
|
|
|
|
|
I am looking for methods you could use to validate that a particular DLL an app is using is the real thing, i.e. it hasn't been replaced by something else with the same function signatures in it.
I was thinking of using a query-response type system when the application first starts up, something like:
1. call a function 'Hello()' on the DLL passing in a callback function as argument to it
2. DLL responds by calling the function supplied within a certain time frame, e.g. after 1 second but before 3 seconds.
3. If callback function is called within the time period then it validates and the app continues to use DLL
I know this isn't perfect, any other methods that may be more robust?
thanks,
|
|
|
|
|
I would like to import an OCX to VC++. How do i make vc create all of the properties and events that VB sees immediatly when I drop it on the form? i tried to drop it on a vc form and use class wizard but it shows nothing? i would rather use vc than vb to make my app.
|
|
|
|
|
Just "dropping" a the ocx on your form does not create a wrapper class for it. Try to map a variable to it, and VC will automatically start for the process of creating a wrapper class. Then you'll have acces to what you need.
SkyWalker
|
|
|
|
|
sorry for being so lame. I am new to activex programming. i have tried to get the idl file which gave me a veiw of all of hte functions. but it does not work. could you send me an example vc prj of doing this?
|
|
|
|
|
I'm trying to implement a simple-minded network-wide locking scheme, by creating (and locking) a file that can be accessed by several clients on different machines. The file is truly unique (eg: \\foo\bar\derf.dat ) across the network.
The attempt to lock the file occurs within my object's open() method. Multiple instances of the object may be running on the same or different machines. The open() method looks like this (Foo::m_pFile is a static member).
bool Foo::open()
{
ASSERT (Foo::m_pFile == NULL);
Foo::m_pFile = fopen ("\\foo\bar\derf.dat", "w");
if (Foo::m_pFile == NULL)
return (false);
...
return (true);
}
However, the following test (running within the realm of a single .exe ) fails - i.e. foo_2 is able to open the object even though foo_1 has it open.
Foo foo_1;
bool bStatus = foo_1.open();
ASSERT (bStatus);
Foo foo_2;
bStatus = foo_2.open();
ASSERT (!bStatus);
Can anyone tell me what I'm doing wrong?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Hi. This might be a stupid question, but i can't find the sulution.
I have a dialog with a list box and i would like it to do the DoDataExchange thing and then exit with IDOK when i doubleklick on a list box item.
What message should i send or what should i do?
Thanks for your answers!
|
|
|
|
|
In the list box double-click handler, call CDialog::OnOK(); .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
ravi's right.
call OnOK() if you want you program to behave as if OK button where pushed (or the button with IDOK id if OK is not its name),
call OnCancel() do close the dialog as if IDCANCEL id's button were pushed.
you can also call EndDialog() to close the Dialog without calling one of the two functions below...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I want to know external definition model of VC++.
but I can't find that information in the web.(probably my mistake...?)
I know 4 external definiton model.
-commonmodel
-relaxed reference/definition model
-strict reference/definition model
-initializer model
Somebody help me please....TT
fksdljflkvmxlcvxcv
|
|
|
|
|
I've never heard, let alone used, any of these terms before. What are they for?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello,
I am new to driver development and I will apreciate if you could help me with my small project.
I am rebuilding ramdisk from known microsoft sample and my interest here is:
1) to get file/directory name which is send or requested by the system
2) process those files by redirecting buffer to another location
3) Showing those file names on a virtual drive as it was actualy copied on it (wonder if its possible to show file names and its size which might not exist at all)
I found a function RamDiskReadWrite within MS Ramdisk sample which is DispatchReadWrite routine, but it reads and writes on very low level ( if I am not mistaken ) like it showen below:
_________________________________________
PIO_STACK_LOCATION irpStack;
PDEVICE_EXTENSION devExt;
...
devExt->DiskImage + irpStack->Parameters.Read.ByteOffset.LowPart
_________________________________________
Is it correct to get file/directory names in code above like this:
irpStack->FileObject ......
if it so could you please extend little bit this code for me.
When I want to read from virtual drive how can I pass buffer from CRT function fread to the system or if its not possible is there any other solution for this?
Thank you very much in advance.
|
|
|
|
|
i have try our the tutorial for diolog n window from the website, but the program just can run 1 time only , the next time i try to run it again it can't work , y is it like tat . n there is some code tat i dun understand for the engine type,after click for the search button
here is the code:
void CSearchDlg::OnSearch() <br />
{<br />
CString strEngine;<br />
int nReturnValue;<br />
<br />
UpdateData();
<br />
m_strSearch = m_strSearchFor;<br />
nReturnValue=GetDlgItemText(IDC_ENGINE, strEngine); <br />
<br />
UpdateData(FALSE);
<br />
if(nReturnValue>0)
{<br />
if(strEngine=="Yahoo")<br />
{<br />
m_strSearch = "http://search.yahoo.com/search?p=" <br />
+ m_strSearch;<br />
ShellExecute(NULL, "open", m_strSearch, <br />
NULL,NULL,SW_SHOWDEFAULT);<br />
}<br />
<br />
else if(strEngine=="Altavista")<br />
{<br />
m_strSearch = <br />
"http://www.altavista.digital.com/cgi-bin/query?" + "<br />
pg=q&what=web&fmt=.&q="<br />
+ m_strSearch;<br />
ShellExecute(NULL, "open", m_strSearch,<br />
NULL,NULL,SW_SHOWDEFAULT);<br />
}<br />
<br />
else if(strEngine=="Excite")<br />
{<br />
m_strSearch = "http://www.excite.com/search.gw?trace=a&search="<br />
+m_strSearch;<br />
ShellExecute(NULL, "open", m_strSearch,<br />
NULL,NULL,SW_SHOWDEFAULT);<br />
}<br />
<br />
else if(strEngine=="Askjeeves")<br />
{<br />
m_strSearch = "http://www.askjeeves.com/AskJeeves.asp?ask="<br />
+m_strSearch;<br />
ShellExecute(NULL, "open", m_strSearch,<br />
NULL,NULL,SW_SHOWDEFAULT);<br />
}<br />
<br />
<br />
}<br />
}
This is where when i execute it , come out error said tat cannot contain 2 pointer.....
- else if(strEngine=="Altavista")
|
|
|
|
|
Hi!
I posted here once more to hope that somebody can help me.
I included in my application a DLL which waits for key press. I realized the questioning (hook) of key press in the DLL. So, when I start my application the
DLL will be started too. The DLL works well. But conditioned that the DLL can register the key press without focusing to my application, I do not know how to
set the focus automatically to my application when the DLL registers a special key press as like as 'F9'.
Here is the code snippet in the DLL I tried to realize:
#pragma data_seg .....
HWND g_hWndServer = NULL;
#pragma data_seg()
#pragma comment(linker, ....
LRESULT CALLBACK KeyboardTracker( int code, WPARAM wParam, LPARAM lParam )
{
if (code==HC_ACTION)
{
if ( wParam == VK_F9 )
{
PostMessage(g_hWndServer, VK_F9, 0, 0);
}
}
return ::CallNextHookEx(g_hHkKeyboard, code, wParam, lParam);
}
__declspec(dllexport) BOOL TrackerInit(HWND hWnd)
{
if ( g_hHkKeyboard == NULL )
{
g_hHkKeyboard = SetWindowsHookEx( WH_KEYBOARD, KeyboardTracker, g_hInstance, 0 );
}
_ASSERT(g_hHkKeyboard);
if ( !g_hHkKeyboard )
{
return FALSE;
}
else
{
g_hWndServer = hWnd;
return TRUE;
}
}
In my application I call the DLL by calling the Dll-function in the event 'OnInitDialog':
BOOL CMyApplicationDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
HWND hWnd = NULL; <<<<<<<========
TrackerInit(hWnd);
return TRUE;
}
How can my application valuate the information of the PostMessage of the DLL????
Is that way upon correct or not?
Where can I place this code to my application?
In hope that anyone know what I mean: Thank you in advance!
|
|
|
|
|
nne-vitamin wrote:
I do not know how to
set the focus automatically to my application when the DLL registers a special key press as like as 'F9'.
Have a look at hot keys. Lookup RegisterHotKey() or WM_SETHOTKEY in MSDN
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|