|
Hi!
How do I use time.h to get milliseconds?
I will write the time as,
hour:min:sec:ms, 13:14:59:123
Thankful for your help
|
|
|
|
|
Hi !
I assume that you know how to get the current time using time_t or __time64_t structures with the appropriate call function. When the call is complete, the member millitm of the structure contains the excess milliseconds.
If you are needing to get the elapsed time in milliseconds, just first calculate the elapsed time in seconds and add the millitm member after your second-millisecond separator.
For an example, search MSDN with keyword '_time64'.
If this wasn't what you meant, please specify in more detail.
-Antti KEskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi. Has anyone tried to build up an Visual C++ application that sends messages using WAP's Push Access Protocol? I have. But I don't know how to do this. What tools can I use (for Proxy Gateway, for Phone Simulator) for my computer to become a stand-alone Push Initiator + Proxy Gateway + WAP Phone Simulator for my application to test on? Examples of code would be considered very usefull.
Thank you
|
|
|
|
|
Hi,
Can anyone help how to transmit BEEPS from telnet server to client.
I have code for telnet server.But i see BEEPS are not getting redirected to client.
Named pipes are used in telnet server...Pls help
Thnks
Ram
|
|
|
|
|
If you are referring to the ASCII 'beep' or bell code, then it is value 0x7. Of course, it all depends on whether the client knows what to do with the beep...
|
|
|
|
|
Hi everyone,
I have a question about SQLBindParameter function. I use this to get return values from SQL server stored procedures. I have the following code, if I want to get an integer:
struct BindParams
{
SQLUSMALLINT ParameterNumber;
SQLSMALLINT InputOutputType;
SQLSMALLINT ValueType;
SQLSMALLINT ParameterType;
SQLUINTEGER ColumnSize;
SQLSMALLINT DecimalDigits;
SQLPOINTER ParameterValuePtr;
SQLINTEGER BufferLength;
SQLINTEGER * StrLen_or_IndPtr;
};
Say, if I want to get an integer back, I use the following:
SDWORD cbParm = SQL_NTS;
BindParams p = {1, SQL_PARAM_OUTPUT,SQL_C_ULONG, SQL_INTEGER,0,0,&myIntVar,0,&cbParm};
And later I call SQLBindParameter with the required parameters.
Thisn works fine. However I would like to get a string back from SQL serve.r I have no idea how to do that. MSDN documentation is really bad on this. So, if someone has any idea on how to do this, I would really appreciate it.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hey i am having the coding for shared memory. But, with the help of that its diificult to me to get the idea abt shared memory. so, pls any one just say what the procedure have to do if i have to develop an shared memory concept file. Just say the logic(wat to do and how to do it) no of the codes.
Thankfull to u..... if done so.,
;
Shanmuga Sundar.V
|
|
|
|
|
Consider looking in the MSDN Reference with keyword 'CSharedFile'. This MFC class is responsible for creating memory-based shared files. Memory files are just like disk files, with the exclusion that they reside in the RAM instead of the hard drive. Shared memory-files, in addition, are accessible from every process of a computer.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hello all !!
I have a SDI application in wich I plot points on a chart (every 13 msec I plot a new point). I created also a separate Thread in wich I acquire the points and store them in a buffer (from the Doc class). I cannot plot the points directly from that Thread (some conflicts appears and I have runtime errors).
So, the points are plotted on the OnIddle() event from the App class. Up to here, everything works fine !!
BUT, sometimes I need to display a dialog box and so, the points are no more plotted behind. So, I was thinking about two solutions: create a separate thread just for displaying the box. But I think that's a little bit heavy . (This is different message box so I wanted to create a function to wich I send the message box and that will create the Thread).
The other solution was to use modeless dialog but there, the problem is that I need to take some specific actions when the dialog is closed...
So, can anybody give me some guidelines or some help ?
Thanks a lots
|
|
|
|
|
In short:
Provide the support thread a pointer to the CWinApp-object of your main thread. Use this pointer to access the m_pMainWnd member and through it, the CWnd-wrapper of the main window.
More detail:
Considering that this is a single-process program, it would be possible for you to use pointers. Cross-thread pointers are a working and a valid solution for all types of applications. If you use MFC, however, you must remember to synchronize the threads properly.
This way, the support thread, once created, should have a pointer to the CWinApp-object of the main thread, and subsequently, it would have access to the m_pMainWnd variable of CWinApp, which is a CWnd-pointer to the application's main window, residing in the main thread. You could use this pointer's AfxMessageBox method to pop up a message box in the main thread's context without any errors. Just remember to pause the plot-messages when the messagebox is active, because no other messages are handled while a modal dialog (messagebox) is visible.
Communication is the key. Make communication functions and variables between your threads. Make the main thread 'speak' to the support thread, and vice versa. Let them know how the other one is doing, and what it is doing.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti Keskinen wrote:
Just remember to pause the plot-messages when the messagebox is active, because no other messages are handled while a modal dialog (messagebox) is visible.
Hum yes but that was my problem !! I want the points to be plotted behind the message box while it's active !!!
So, for you, is it possible doing such a thing using a separate Thread? Or the only solution is the use of modeless dialogs ?
Thanks for your response
|
|
|
|
|
I suspect that you may have to use a custom modeless dialog box to display your messages.
As far as I know, Window's ::MessageBox() (encapsulated by AfxMessageBox()) can only be displayed in a modal state, so whereever you create the dialog, the parent thread will be blocked.
If you really need to use AfxMessageBox(), then I suppose you could create a UI Thread to handle the blocking message dialog, but I think this would be an overkill.
I Dream of Absolute Zero
|
|
|
|
|
RChin wrote:
I suspect that you may have to use a custom modeless dialog box to display your messages.
Yep !
But the thing is I need to display several dialog boxes (when one is closed, I need another to open, and so on...). So I need to keep a pointer to the parent's window and send message to it.
Okay, so I think this is the best solution but it will be somewhat complicated to implement (I need to take also specific actions in the document in response of the user input) . So I that's why I was wandering about a separate Thread.
Thanks for help.
|
|
|
|
|
In this case, you have two solutions:
1. Pop up a modeless dialog in the main thread (easy)
2. Create a seperate thread which will pop up a modal message box (harder)
I would suggest trying method #1. It is by far the most easiest way to accomplish it. When creating the dialog class, add an OnClickButton handler and put it to call DestroyWindow instead of EndDialog . This will make sure that the underlying window object is properly destroyed when the dialog closes up. No other changes are needed for modeless dialogs to work smoothly. To create it, construct an object and call Create .
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi,
How do i extract the icon of an associated file.
any help will be helpfull.
Thanx in advance
Prakash.
The World is getting smaller and so are the people.
|
|
|
|
|
SHGetFileInfo() will retrieve the index of the file's icon in the system image list.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
The other way is:
1.Get full path to the associated program
2.Get default icon
3.Use ExtractIcon on it
Example: *.htm
1.Look for default value of HKCR\\*.htm (it is htmlfile)
2.Find default value of HKCR\htmlfile\DefaultIcon
This is C:\Program Files\Internet Explorer\iexplore.exe,1
3.Call ExtractIcon with iexplore.exe, first icon
Peter Molnar
|
|
|
|
|
Hi
Does anyone have the file window.h to linux?
I need the file for using QueryPerformanceCounter and QueryPerformanceFrequence.
Thank for your time
|
|
|
|
|
jsut the header file is not going to satisfiy your problem, you also need windows library also, now linking windows lib and .h file in linux,hummm well as far as i know, its not possiable..
you sould look for similar thing that linux offers.
regards,
prakash.
The World is getting smaller and so are the people.
|
|
|
|
|
|
I am using files with <fstream.h>. My objective is be appending data to a file in its first line, for example:
11111 -> 22222 -> 33333 -> 44444
11111 22222 33333
11111 22222
11111
My code, executed each five minutes:
arxiu.open(FileName,ios::app);
arxiu.seekp(ios::beg);
arxiu<<data<<endl;
arxiu.close();
... but="" it="" doesn't="" work...the="" code="" does:="" 11111="" -=""> 11111
22222
I'll thank any help.
|
|
|
|
|
Try the below code
I hope it may be work
else i will try and say
arxiu.open(FileName,ios::app);
arxiu.seekp(ios::end);
arxiu<
|
|
|
|
|
Sorry but It doesn't work.
thanks
Christian
|
|
|
|
|
I have been using a 3rd party manufactores PCI databus card API.
Now other people have been using a simular card and API within the company.
So the idear of each writing a library for their manufactures API with a common set of procedures was raised.
I am attempting to write my library first, but the only time I tried to create a library I kept running into problems, linking etc.
Any good examples/notes. The term Static library was muted.
Note the libray must be usable for Win32 MFC and Win32 console applications.
|
|
|
|
|
Hi, I have searched those articles and posts in CP, but found nothing talking about using the ActiveX control, Microsoft ADO Data Control, with Visual C++.NET (V7.0 / V7.1).
What I have learned:
1) Insert the adodc (ADO Data Control) into the dialog box.
2) Configure the properties (the connection string, the record sourcce, etc).
3) Bind to a MS DataGrid Control to display data.
What I would like to know about how to program the ADO Data Control / MS DataGrid Control in my code for the following purposes:
1) Enumerate all the tables / views in an Access Database.
2) Change the record source from Table_A to Table_B programmatically and refresh the MS DataGrid Control.
3) How to use ADO Data Control to navigate data without the MS DataGrid Control.
Thanks in advance!
Maxwell Chen
|
|
|
|