|
Sorry, I guess I didn't present that very well.
NAN is an exponent of 0x7FF with a non-zero mantissa.
INF is an exponent of 0x7FF with a zero mantissa.
Here are the actual fuctions I am using...
bool IsInf (double d)
{
const INT64 iInf = 0x7FF0000000000000;
if ((*(INT64*)&d & 0x7FFFFFFFFFFFFFFF) == iInf)
return true;
return false;
}
bool IsNan (double d)
{
INT64 exp = *(INT64*)&d & 0x7FF0000000000000;
INT64 mantissa = *(INT64*)&d & 0x000FFFFFFFFFFFFF;
if (exp == 0x7FF0000000000000 && mantissa != 0)
return true;
return false;
}
modified on Friday, November 27, 2009 3:04 PM
|
|
|
|
|
Hi All,
I have created COM component(dll) and created one client to use it, Please finnd the code of client:-
HRESULT hr = CoInitialize(0);
SCRIPTOBJLib::IScriptObjPtr sobj;
sobj->SetLanguage((unsigned short *)"VBScript");
CoUninitialize();
Please give me some solutions coz i tried every possible way.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
Ash_VCPP wrote: SCRIPTOBJLib::IScriptObjPtr sobj;
//sobj->QueryInterface(IId_,void* &vp);
You have not initialized sobj to an instance of anything.
|
|
|
|
|
Yes but i tried many ways as you can see it in commented code to initialize it, but getting error HRESULT value= -2147221164.
can you please suggest me how can i initialize com object with example regards of my code.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
Ash_VCPP wrote: can you please suggest me how can i initialize com object with example regards of my code.
You have the following declaration in your code
SCRIPTOBJLib::IScriptObjPtr sobj;
So you need to initialize sobj to an instance of SCRIPTOBJLib::IScriptObjPtr . The documentation should explain how to do this. If you do not understand instances of classes I suggest you refer back to he C++ documentation for guidance.
|
|
|
|
|
But i think initializing COM object is different from normal class, and if not then can you please show me few lines of code to initialize COM object, Because i am wondering with google since last two dyas.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
As I said in my previous entry you need to use the documentation; I have not used the library that you are working with. Perhaps some time reading through some of the COM articles here on CodeProject would be time well spent.
|
|
|
|
|
The HRESULT you have indicated is 0x80040152 - Could not find the key in the registry
Sounds like the COM object you are trying to use is not correctly installed or you are not using the correct ProgID.
Try using a CLASSID for your CreateInstance.
|
|
|
|
|
Hi Jeff,
I think the helpstring which we pass in idl file will be the progID please let me know if i am wrong,So here i am using below line to get the class id:-
HRESULT hres1 = CLSIDFromProgID(OLESTR("ScriptObj 1.0 Type Library"), &clsid);
But still i am getting the same error.I have seen registry entry for my dll and its there with the string i mentioned in above function.Please provide me some suggestions on this.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
If the return from this is 0x80040152 it is not being found in the registry. I suggest try the class id just as the next step of investigation. This HRESULT is either the client not registered correctly or using the incorrect ProdID.
|
|
|
|
|
hi,
im reading a large text file using fstream. below is my code:
<br />
char logfile[10] = "log.txt";<br />
char data[100];<br />
<br />
fstream open_logviewer(logfile, ios::in);<br />
<br />
while(!open_logviewer.eof()){<br />
open_logviewer.getline(data,100);<br />
cout << data << endl;<br />
} <br />
open_logviewer.close();<br />
because the file has so many lines of data, when the program is executed, it will run through the data quickly to the end of line. this makes it hard for the user to read the data.
how can i give user an option to probably press enter to view let say next 10 lines?
|
|
|
|
|
require user input using C++'s cin or C's scanf
|
|
|
|
|
hi,
erm what you're referring is read user input and print the particular line?
if it is, i'm actually looking to print the whole chunk but allowing user to able to read every 10 lines per screen, after which, they press tab or enter to continue next 10 lines.
|
|
|
|
|
hmm i got it. its pretty simple acutally. i just simply find the difference between the counter and the prev 50 page.
it looks like this:
<br />
char logfile[10] = "log.txt";<br />
char data[100];<br />
<br />
fstream open_logviewer(logfile, ios::in);<br />
<br />
int counter = 1;<br />
int prev = 0;<br />
while(!open_logviewer.eof()){<br />
open_logviewer.getline(data,100);<br />
cout << data << endl;<br />
<br />
if((counter - prev) == 50){<br />
prev = counter;<br />
system("pause");<br />
}<br />
<br />
counter++;<br />
} <br />
open_logviewer.close();<br />
<br />
|
|
|
|
|
nuttynibbles wrote: if((counter - prev) == 50){
What is the point of prev ? A simple counter from 1 to 50 is all that's needed, resetting to 1 every time it hits 50. Something like:
if(counter++ == 50)
{
system("pause");
counter = 1;
}
|
|
|
|
|
this idea also works. thks
|
|
|
|
|
Hey everyone!
I'm currently working on a project that is going to require access to various command line applications. Mostly in order to grab status updates from various processes that are running on the system.
A sample of the command line program would be as follows:
C:\Program\Folder>System.exe -Enable "10:22:00" -Disable "10:23:00"
SYSTEM ONLINE - 11/25/2009 10:22:35 GMT
SYSTEM ONLINE - 11/25/2009 10:22:40 GMT
SYSTEM ONLINE - 11/25/2009 10:22:45 GMT
SYSTEM ONLINE - 11/25/2009 10:22:50 GMT
SYSTEM ONLINE - 11/25/2009 10:22:55 GMT
SYSTEM OFFLINE - 11/25/2009 10:23:00 GMT
SYSTEM OFFLINE - 11/25/2009 10:23:05 GMT
SYSTEM OFFLINE - 11/25/2009 10:23:10 GMT
Etc. Etc. Etc.
I need to be able to grab that system status from this and other programs and return them to a GUI application in Visual C++.
How can I grab the resultant output of the console as a string? I realize that many people simply dump the data to a file and then read from the file, but I'm looking for something a bit more direct. Is this even the correct way to approach the problem of grabbing status from an external process? My restrictions are that it does have to be for Windows and in Visual C++.
Thanks for the help!
-N. Rackley
|
|
|
|
|
You will probably need to use the system() or _popen() call to get what you need. Take a look at the MSDN references[^] for more information.
|
|
|
|
|
|
Hi all..
I am facing a problem with the font selection in menu..
here the color of font is not changing once selected.. but the type and size everything is changing as per selection..
Iam using CreateFontIndirect
and below is my code for OnFont()
CWnd *pwnd = CWnd::GetFocus();;
int wID = pwnd->GetDlgCtrlID();
LOGFONT If;
CFont *font = new CFont();
if(wID==IDC_SAFE)
{
CFontDialog FontDlg(&If);
if(FontDlg.DoModal() == IDOK)
{
font->CreateFontIndirect(&If);
m_edittext.SetFont(font);
}
}
plz help me to solve it
|
|
|
|
|
I think you need to set the text colour independently of the font, with the value from the CFontDialog.GetColor() method.
|
|
|
|
|
thanku Richard...
n sorry for the late reply..
i tried implementing ur sggestion but dat too is not working....
|
|
|
|
|
sonualex wrote: i tried implementing ur sggestion but dat too is not working....
Sorry, but I cannot guess what is not working, you will need to explain what you have done and what results you are getting.
|
|
|
|
|
I am trying to create a ccomboboxex using createwindow function.but I get the old combobox look(3d gray).
How can I get the XP appearance combobox? Any idea? thank you.
|
|
|
|
|
It happens not only for controls you create but also for all windows.
There are several ways you can achieve this. the easiest is to include a manifest file to enable visual styles.
Manifest should have following name: appname.manifest. For example SomeApp.exe.manifest.
Include manifest file in the same directory as your executable module. That is it.
To avoid copying or including additional file in you distribution package, you can include manifest file as a resource in your project but this is a little bit more complicated.
JohnCz
MS C++ MVP
|
|
|
|