|
Good evening.
I want to know the cpu temperature sample code.
I want something that is written in Visual C ++ code.
Wait a minute you know you had one answer or experience.
Thanks.
|
|
|
|
|
|
I can give you some pointers (no pun intended) using WMI.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hello,
I have a namespace and class defined inside a cpp file (say x.cpp ). I want to declare this class as 'friend' inside another header (say y.h), but the header won't recognize the namespace.
Now, when I put the namespace in another header (x.h) and include it in y.h, I get a re-definition error ( also in x.cpp ). I can't remove the namespace definition from x.cpp, since it has been put together by a framework for me, and I won't be able to use the framework otherwise.
Does this mean I can't declare this class as friend of any other class ?
Regards,
Raj Abhishek
|
|
|
|
|
Can you post the relevant code snippets? It's hard to tell what's going on from your description.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
If I remember correctly you can (at least in VS 6.0) include .cpp files the same way you include header files. However it's not a very good practice.
You could consider defining some kind of helper class or interface class in z.h and include this file in both x.cpp and y.h. Then you could declare z a friend of y and "channel" the function calls from x through z. Alternatively you could even derive y from z and wouldn't need a friend declaration.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Have you already tried a forward declaration, like this:
namespace myspace {
class x; };
class y {
friend myspace::x;
};
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Hi,
I'm developing a wxWidgets 3.0 project using this Json_spirit library with boost 1_46_0 in Visual Studio 2008.
I Edited all the Additional directories and Additional Dependencies in the properties
After compiling the project I'm getting linkage error like
"
error LNK2019: unresolved external symbol "bool __cdecl json_spirit::read(class std::basic_istream<char,struct std::char_traits<char> > &,class json_spirit::Value_impl<struct json_spirit::Config_vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?J_read@json_spirit@@YA_NAEAV?$basic_istream@DU?$char_traits@D@std@@@std@@AEAV?$Value_impl@U?$Config_vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@json_spirit@@@1@@Z) referenced in function "private: class wxWindow * __cdecl HiFrame::ReadingJson(class wxWindow *,class wxString &,class wxString &)" (?ReadingJson@HiFrame@@AEAAPEAVwxWindow@@PEAV2@AEAVwxString@@1@Z) "
can anybody help me out to resolve this problem.??
thanks..
modified 27-Mar-15 5:20am.
|
|
|
|
|
You are missing a library in your linker section. Check the documentation for the library in question and it will tell you what you need to include.
|
|
|
|
|
"json_spirit.h" i have included this file for reading json file.
|
|
|
|
|
Member 11258353 wrote: "json_spirit.h" i have included this file for reading json file. That is a header file used during compilation.
But you got a linker error telling you that a library is missing (the name may be json_spirit.lib).
|
|
|
|
|
yeah, I have included that lib also(json_spirit_lib.lib)
which is in json_spirit_v4.08\Debug path.
Still, The error is coming.
|
|
|
|
|
Check the name and path of the library and the corresponding project settings. The path must be part of the library search path or the complete path must be specified.
|
|
|
|
|
Okay,
For json_spirit_lib.lib in properties->linker->additional Library directory i gave this path "D:\json_spirit_v4.08\Debug"
For json_spirit.h in properties->c++->additional include directories i gave this path
"D:\json_spirit_v4.08\json_spirit"
For boosting in properties->c++->additional include directories i gave this path
"D:\boost_1_46_0"
In properties->linker->Input->Additional dependencies i included json_spirit_lib.lib.
Still not getting,,
|
|
|
|
|
To get more information you should enable verbose output for the linker (Project Settings - Linker - General - Show progress: VERBOSE).
You may also use the dumpbin command line utility (in the VC/bin directory) to check which functions are exported by the library.
The library must be build for your VS version. Did you build it yourself?
Did you get only one or multiple linker errors?
|
|
|
|
|
Getting Linkage errors at Both Json_spirit::Read() and Json_spirit::Write() functions.
Just again i build the lib. now i'm getting error like
1>c:\documents and settings\administrator\my documents\downloads\boost_1_46_0\boost\function\function_base.hpp(408) : fatal error C1128: number of sections exceeded object file format limit : compile with /bigobj
what to do??
modified 27-Mar-15 8:29am.
|
|
|
|
|
The error message gave you the answer:
Member 11258353 wrote: compile with /bigobj
You may also search the web for this error message related to boost.
|
|
|
|
|
|
My software is an excel plug-in. We are using the C++ unit test framework embedded within Visual Studio to test it.
Now, in my C++ unit test-code, when I open excel ( e.g. through shellexecute ), Excel opens up in a separate process and hence, I am not able to test my add-in code in the test process.
How do I attach to the excel programatically so that I can follow the behaviour in the same process.
It's a unit-test scenario and hence, we are trying to do everything with least manual intervention.
Regards,
Raj Abhishek
|
|
|
|
|
You need add the Interop.Excel.dll to your project. With that dll you can create a excel application to handle menus, bars, and so on.
The documentation is [here]
|
|
|
|
|
Hello,
i'm quite new to MFC programming and I would like if my software architecture can be simplified.
Let's suppose to have an MFC program where I put a member variable in CView class. This variable is set by a control put in a dialog window called by a menù.
I usually set a control variable in order to get the control value in order to avoid the GetdlgItem command.
The value of the control is used to set a member variable inside tha class of the dialog window and then when i close the dialog I copy the value of the dialog's variable into the main window variable
control variable -> member variable of the dialog window -> member variable of the main Cview window
With this scheme I Have to use 3 variables for each controls and this is quite expensive.
Can anyone suggest me a simpler way to get to synchronize the variable used by the main window with the value of a control inside a dialog window?
Best regards.
|
|
|
|
|
As I understand your problem, two variables are needed: one used by the dialog class, and the other used by the view class.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Yes, two variables. But I don't know if there is a better way to get the same result.
|
|
|
|
|
If you are worried about the memory needed to store several values twice, you could define a class or struct, create an object of it in your view class and pass the reference to this object to the dialog objects in their constructors. This way you only have 4 byte overhead per dialog.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
for avoid flickers i must do:
1 - use the WS_CLIPCHILDREN on parent window;
2 -
case WM_ERASEBKGND:
{
return (LRESULT) 1;
}
break;
seems be used only on parent window too.
the child controls are transparent:
(i use the button class for create a label. why?!? because be correctly transparent using the BS_OWNERDRAW style.)
case WM_ERASEBKGND:
{
return (LRESULT)1;
}
break;
case WM_CTLCOLORSTATIC:
{
return (LRESULT)GetStockObject(NULL_BRUSH);
}
break;
case WM_PAINT:
{
PAINTSTRUCT test;
BeginPaint(hwnd, &test);
image imglabel(test.rcPaint.right-test.rcPaint.left,test.rcPaint.bottom - test.rcPaint.top);
brush brshbackcolor(inst->clrBackColor);
brshbackcolor.ToDC(imglabel);
brush brshTransparent;
FillRect(imglabel,&test.rcPaint,brshbackcolor);
if(inst->imgtest.haveimage())
DrawHICONtoHDC(imglabel, inst->imgtest,1,1);
SetBkMode(imglabel,TRANSPARENT);
char *text=(char*)inst->strCaption.c_str();
SetTextColor(imglabel,inst->clrTextColor );
DrawTextEx(imglabel,text,-1,&test.rcPaint,DT_LEFT,NULL);
if(inst->blnBorder==true)
DrawEdge(imglabel, &test.rcPaint,BDR_SUNKENINNER | BDR_RAISEDOUTER,BF_RECT);
TransparentBlt(test.hdc,0,0,test.rcPaint.right,test.rcPaint.bottom,imglabel,0,0,test.rcPaint.right,test.rcPaint.bottom, inst->clrBackColor);
EndPaint(hwnd, &test);
return 0;
}
break;
and the how i readraw the window:
RECT d;
GetClientRect(hwnd,&d);
RedrawWindow(hwnd,&d,nullptr,RDW_UPDATENOW | RDW_INVALIDATE | RDW_ERASENOW);
but when, with animation\timer, the next image is drawed above the older one, instead clean all control and then redraw it.
(i need avoid the flicker and draw the control correctly and not 1 image above other)
can anyone advice me?
|
|
|
|