|
includeh10 wrote:
communication port is not an easy job
Yes, thats true, and to be honest I have only one thread at the moment so that is obviously not helping. Looks like its time to look at threads!
Thanks for the advice,
Ali
|
|
|
|
|
I did something similar for a data collection thread that has to get spectra from a Diode array detector on set intervals. The way I did it was to the set thread priority very high (TIME_CRITICAL), so when the Sleep() completed, that thread was given control again. As it spent most of its time in a sleep() state it did not have any adverse effect of system performance.
Some of the oce envolved was:
RunThread->SetThreadPriority(THREAD_PRIORITY_TIME_CRITICAL) ;
FILETIME time1;
FILETIME time2;
::GetSystemTimeAsFileTime(&time1) ;
while (...)
{
::GetSystemTimeAsFileTime(&time2) ;
delay = (m_spectra_frequency * spectra_collected) - CalculateElapsedTime(&time1, &time2) ;
if (delay >= 0.001)
Sleep((unsigned long)(delay * 1000.0)) ;
}
double CalculateElapsedTime(FILETIME *start, FILETIME *current)
{
double elapsed_time ;
__int64 st ;
__int64 ct ;
__int32 *p ;
p = (__int32*)&st ;
*p++ = start->dwLowDateTime ;
*p = start->dwHighDateTime ;
p = (__int32*)&ct ;
*p++ = current->dwLowDateTime ;
*p = current->dwHighDateTime ;
elapsed_time = (double)(ct - st) ;
elapsed_time /= 10000000.0 ;
return elapsed_time ;
}
It may be of use
Roger Allen
Sonork 100.10016
I have a terminal disease. Its called life!
|
|
|
|
|
Thanks for the advice. Believe it or not I've got away with just one thread in all my apps up to now! But it looks like I cannot run away any longer, now is the time to look at threads.
I think I can see what you are explaining, its nice to have the code snippet to look at - I'll give it a go.
If you see some more questions about threads from me in the coming days you'll know it hasn't gone well!
Thanks again,
Ali
|
|
|
|
|
If I have this below CString data and I want to change it format to int.
Example:
CString data_str = "1487";
int data_int;
I want
data_int = 1487
Do you know how to do that?
|
|
|
|
|
Sometimes the C runtime comes in handy: atoi()[^]
|
|
|
|
|
use:
data_int = atoi( (LPCTSTR)data_str );
or even better use:
data_int = _ttoi( (LPCTSTR)data_str ); // unicode safe
|
|
|
|
|
I have used Visual Studio Installer to produce some MSI files
to install my applications.
I some PCs, where only WINNT or WIN2K OS is installed (MS office
not installed)the MSI file cannot be executed.
Does someone knows which application or DLL must be installed in
the target machine in order to allow the MSI file execution ???
Thank a lot !!!
|
|
|
|
|
|
I believe in your properties area for your project you can say to compile into a msi or setup.exe with installer support.. then it will output a .msi plus a setup.exe etc... then you have to distribute all the files in your output dir..
|
|
|
|
|
Hello all
according to ms features list, I have checked out the comparison table and it seems to me that vc++.net standard is missing the following features:
1) Enhanced professional C++ Optimizing Compiler
Build and deploy professional-quality applications with the industry's leading C++ Optimizing Compiler, which generates the smallest and highest performing executables. Now with Whole Program Optimization technology.
2 Enhanced advanced application wizards
Easily generate advanced C++ projects with professional-level application wizards for MFC ISAPI dynamic-link libraries (DLLs), Custom Visual Studio Wizards, and more.
3 Built-in support for additional programming languages
With support for multiple programming languages, you can easily program in the language of your choice and integrate the code from any other language.
4 Remote Debugging
Extend your debugging capabilities by stepping seamlessly into remote processes, including XML Web services.
5 SQL Debugging
With the Visual Studio .NET debugger, you can debug Microsoft SQL™ Server stored procedures, functions, and triggers in much the same way that you debug other kinds of scripts or programs.
6 Crystal Reports
Build rich interactive reports for Windows-based, Web-based, and mobile applications, as well as XML Web services.
7 Visual Database Tools
Design stored procedures, indexes, tables, triggers, user-defined functions, and other database elements visually. In the Visual Studio .NET Professional Edition, these design capabilities are limited to the SQL Server Desktop Engine.
8 Extended Stored Procedure DLLs
Create SQL Server extended stored procedures (XPROC) in C++ with the Extended Stored Procedure DLL project template.
Now, as I am planning basically to write freeware/shareware applications it seems to me that the Vc++.net standard fits my needs. In particular 2) to 8) seem to me options i reasonably will use very little.
As far as the 1) is concerned vc++.net standard offers a
Non-optimizing C++ Compiler to
Build and deploy C++ applications with performance and size characteristics appropriate, as MS tells, for hobbyist, student, and beginning programmers.
Now i have tested some siple projects (ie: wizard generated for MDI/SDI and dialog applications) and reported (working on windows XP HE) EXE sizes like the folllwing (release versions):
-SDI: close to 300 Kb
-MDI: close to 370 Kb
-DLG based appl.: close to 156 Kb
Which are the typical EXE sizes for similar projects generated and, i guess, optimized/tweaked by the VS.NET compiler?
Besides that, although the MS features comparison list pointing out the Non-optimizing C++ Compiler of this edition, i can find:
a) an 'optimize the whole program' option under the general projects settings page
b) an 'optimizazion page' under c/c++ with: 'enable independent optimizazions', 'processor optimizazions' and 'optimize for windows applications'
c) Linker/optimizazion
enable COMDAT reduction
optimize for win 98
functions order
I wonder if working on all and/or some of the above parameters i could get better EXE sizes and/or other useful optimizations, of course without troubles (otherwise i will leave those options like they are automatically set up by the IDE)
any help/tip/info will be greatly appreciated
thanks in advance
|
|
|
|
|
Hello all
with reference to VC++.NET
i'd like to figure out a little more deeply the following options (under project settings/c/c++ code generation options page):
runtime library:
/MD[d]
/ML[d]
/MT[d]
/LD[d]
I don't know much about 'threads', i have just noticed that when i select an 'MFC statically linked application', the compiler puts for me /MT[d for debug version] and puts /MD for an 'MFC linked as a shared DLL' project.
I have read the compiler help about these parameters but it isnt' actually much clear, so any tip/info will be greatly appreciated
I especially wonder if, say, i can 'forget' almost everything about these options as long as i will be just selecting 'statically linked MFC projects' (ending in /MT) or 'dynamically linked ones (ending in /MD) or, even if the wizard inserts, as pointed out below, them automatically, there are particular situation needing a further tweaking.
thanks in advance
|
|
|
|
|
Here is a short insight :
Is your application single-threaded or multi-threaded ?
If you answer single-threaded, then you use the single-threaded C/C++ run-time with the /ML switch. Of course, if you are compiling in debug mode, you use /MLd instead.
(The single-threaded run-time is libc.lib, libcd.lib in debug mode).
Now if you are multi-threaded, you need a multi-threaded C/C++ run-time, that is a run-time which is thread-safe (slower but safe). Do you want this run-time be statically linked (no distribution), or do you want it be loaded as a separate dll ?
If you answer statically linked, then use /MT. Of course, if you are in debug mode, use /MTd instead.
(The multi-threaded run-time is msvcrt.lib, msvcrtd.lib in debug mode).
If you answer as a separate dll instead, then use /ML. Of course, if you are in debug mode, use /MLd instead.
(The multi-threaded run-time is msvcrt.dll, msvcrtd.dll in debug mode).
Last note about the relation with the MFC : by design, the MFC uses the multi-threaded C/C++ run-time. You can use it statically linked, or use it as a separate dll.
I hope this clarifies the situation.
Back to real work : D-25.
|
|
|
|
|
Hi
I need some help regarding invoking Address book look from my application.
I have created an application and has added an addin .
Now i want to invoke address book of outlook and get its contents.
can any body help me in this regard.
Thanx and regards
Sufiyan Sana
|
|
|
|
|
|
I just want to invoke the address book and retrieve the entries.
but the link you provide me doesnt explain that.
regards
|
|
|
|
|
Yes it does. It tells you the Office HELP file where you'd find the information (at the bottom of the page.)
|
|
|
|
|
Do you mean Outlook Express Address Book?
Do you mean the Exchange Address book ?
Or do you mean Outlook Contacts?
Each has it's own way of being accessed depending on how Outlook is configured.
The most flexible way is via MAPI but this is the most complicated route. Do a search for MAPI and the IAdrBook interface.
CDO is probably an easy method but there are limited C++ samples. Have a read on MSDN about CDO and you should have a starting point.
Michael
Life’s not a song.
Life isn’t bliss.
Life is just this.
It’s living. -- Buffy the Vampire Slayer: Once more, with feeling
|
|
|
|
|
Hi guys, I've been using the VS .NET IDE for some time now to do regukar C++ programming and so far so good.
But this weekend I wanted to explore GDI+ and wrote the following little app.
#include <windows.h><br />
#include <gdiplus.h><br />
<br />
using namespace Gdiplus;<br />
<br />
int main()<br />
{<br />
Bitmap b(L"a.bmp");<br />
<br />
return 0;<br />
}
I compiled and got 6 LNK2019 (unresolved external symbol) errors.
They are all along the lines of
gdistuff error LNK2019: unresolved external symbol _GdipFree@4 referenced in function "public: static void __cdecl Gdiplus::GdiplusBase::operator delete(void *)" (??3GdiplusBase@Gdiplus@@SAXPAX@Z)
gdistuff error LNK2019: unresolved external symbol _GdipCloneImage@8 referenced in function "public: virtual class Gdiplus::Image * __thiscall Gdiplus::Image::Clone(void)" (?Clone@Image@Gdiplus@@UAEPAV12@XZ)
etc etc
And I don't really see why there is a problem. Compiling with the /VERBOSE linker option tells me that all the needed file paths are being searched during compilation and linking. And I have all the required header on my machine courtesy of VS. NET. What step did I miss? Could someone either verify this or at least point me to a setting I missed?
Thanks
Senkwe
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
Go into Project Properties, Linker, Input, Additional Dependancies, and ensure gdiplus.lib is among the libraries listed there.
Shog9
------
to the revelations of fresh faced youth
no one will come to save you
so speak your peace in the murmurs drawn
but youth is wasted on the young - Smashing Pumpkins, Thru the Eyes of Ruby
|
|
|
|
|
Thanks Shog, did the trick. You know, it's linking to gdi32.lib and for some reason, everytime I saw it I kept thinking, "well there's hte lib file, why is this thing still giveing me errors??"
An X-File moment.
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
Hello
I'm rather new with VC++ development, so perhaps this is a stupid question, but I would like to create an HTML document from my application that contains a report but how do I launch this document in a browser window when it has been created?
Thank you for your Help
Henrik
|
|
|
|
|
There might be a better way to do this, but you can launch Internet Explorer by using the ::CreateProcess() API. You can then just pass to IE, the path to your file and it will open your file with IE. Look on MSDN for more info on it.
Or you can use the CHtmlView control which displays HTML documents using IE.
- Anatari
|
|
|
|
|
<br />
<br />
::ShellExecute( NULL, _T("open"), _T("iexplore.exe"), m_strURL, NULL, SW_SHOWDEFAULT );<br />
This code will always launch Internet Explorer and load the file specified by m_strURL. If you want to use the default browser then replace _T("iexplore.exe") with NULL.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
I have a property page (CPropertyPage ) with a CListCtrl and some buttons. With this buttons I can delete a item in the CListCtrl or change the position of a item in the CListCtrl (up or down).
So, the problem is that I want to make the current selected item allways be marked as the selected item.
I have tried to set the focus in every button handler (On...() ) to the list box (CListCtrl ):
m_ctrlList.SetFocus();
That works fine, when I click on a button. The focus switch back to the list box. But when I click anyone else on the property page the list box lost the focus and the current selected item will be marked in some gray (the background of an item will be gray).
So, I want that the current item will be allways be marked in blue and that the list box will never lost the focus, when I click anywhere on the property page.
How to make?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Can't you handle the property page the same way you handled the buttons? I believe they are all derived from the CWnd class.
- Anatari
|
|
|
|