|
Hi,
you may try freemodbus library.
The URL is
http://www.freemodbus.org/index.php?idx=5
|
|
|
|
|
Hello!
I have following problem. I want to create a application, which is using Netsh. I have created following code:
private: System::Void button1_Click( System::Object ^ sender, System::EventArgs ^ e ) {
Process ^ mojProces = gcnew Process();
ProcessStartInfo ^ startInfo = gcnew ProcessStartInfo( "cmd.exe" );
startInfo->Verb = "runas";
startInfo->Arguments =( "Administrator /c \"netsh wlan start hostednetwork\" " );
startInfo->UseShellExecute = false;
startInfo->CreateNoWindow = true;
startInfo->RedirectStandardOutput = true;
startInfo->RedirectStandardInput = true;
info->Text = "Sieć została uruchomiona.";
mojProces->StartInfo = startInfo;
mojProces->Start();
StreamReader ^ wynik = mojProces->StandardOutput;
String ^ wynik_konsoli = wynik->ReadToEnd();
wynik_wysw->Text = wynik_konsoli;
mojProces->WaitForExit();
mojProces->Close();
Now I would like to redirect output of CMD, but there is following problem. When I set UseShellExecute=false, I cannot run CMD with administrator privileges, which is required to use Netsh. But when I set true I cannot redirect output. Could you please help, how can I solve this problem? Thank you in advance!
|
|
|
|
|
if i have a function will used by a thread, how i lock it? i do not want the thread to finish..., as below
Main function()
{
----lock this area
code
another function()
code
code
----unlock this area
}
basically the Main function wont be executed by another thread until it's done..?
how?
modified 5-Feb-14 2:50am.
|
|
|
|
|
|
Dear readers,
I have a endless loop, which has internal state. How can this be modelled with UML-State-Diagram?
static int state = 0;
void mySstateTest(void)
{
for(;;) {
DoSomeImportantAction();
if ( 0 == state ) {
if ( 1 == ReadSomeData() ) {
state = 1;
}
}
if ( 1 == state) {
if ( 0 == ReadSomeData() ) {
state = 0;
}
}
}
}
Is there a better place for asking this question
Thank you
modified 26-Jan-14 15:18pm.
|
|
|
|
|
Frygreen wrote: Is there a better place for asking this question We don't appear to have a forum dedicated to UML, so perhaps you could try the Quick Answers section.
Veni, vidi, abiit domum
|
|
|
|
|
Frygreen wrote: How can this be modelled with UML-State-Diagram?
State 1 points to state 0.
State 0 points to state 1.
|
|
|
|
|
A bit hard without the ability to embed an image, but I'll try:
/*********\
* *
* state 0 *
* *
\*********/
| ^ ^
| | |
v no| |yes
/ \ | |
/ \ | |
R==1?>-+ |
\ / ^
\ / / \
V / \
| <R==0?>-+
| \ / |
|yes \ / no|
| V |
| ^ |
| | |
v | |
/*********\ |
* * |
* state 1 *<--+
* *
\*********/
Ok, the readability suffers a bit - sorry for the bleeding eyes
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)
|
|
|
|
|
I'm learning dev C++ later to make an application any advice please?
|
|
|
|
|
Buy a book on C++, or use Google to find some of the thousands of samples that are available.
Veni, vidi, abiit domum
|
|
|
|
|
Identify your primary objective. If it is producing a new application, then stick to the language you know best, but if it is learning C++ then follow Richard's advice.
I faced the same choice some years back, and since my primary objective was learning C++ I went down this route. Had it been the production of a new application I would have continued with COBOL.
I never had any desire to branch out into C# but it made practical sense to adopt it for the WCF and ASP.NET aspects so that got learned too. Nowadays Visual Studio, and particularly the express versions offer better UI experiences in C#, so consider that C++ may not offer all you desire.
Ger
Ger
|
|
|
|
|
Hi,
I am using Sumatra in my Visual Basic 6.0 like this
Dim cmdline as string
Dim ret as integer
Dim hwnd As Long
Dim gstrPathAndFilename as string
gstrPathAndFilename="C:\test.pdf"
hwnd = Picture1.hwnd
cmdline = "C:\Program Files\SumatraPDF\SumatraPDF.exe -plugin " & hwnd & " " & gstrPathAndFilename
ret = Shell(cmdline)
The above code works perfectly in VB6.
Now I am trying to convert the above code to Visual C/C++ 6.0 like this
static HWND hwndPicture ;
hwndPicture = GetDlgItem (hwnd, IDC_PIC) ;
ShellExecute(
hwndPicture,
TEXT("open"),
TEXT("C:\\Program Files\\SumatraPDF\\SumatraPDF.exe"),
"d:\\Test\\test.pdf",
TEXT(" d:\\ "),
SW_SHOWNORMAL);
It works but not inside the form and picture box, it opens a new window.
Can someone help me, I new in Visual C++
Thanks,
Russell
|
|
|
|
|
Well, for one thing, you're failing to pass the "-plugin" parameter on the command line in the C++ version.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Well, there are several functions which converts MBCS to WCHAR.
Among them, I often used A2W and MultiByteToWideChar. But I don't know the difference and which is the best.
Often, A2W is very simple to use but when I use it in the scope of while or thread, It often occurred stack over flow errors.
What's wrong?
Could anybody notice me which function is the best and which A2W occure Stack Over flow error?
Thank you. 
|
|
|
|
|
|
|
Dear Experts
I am designing a c++\mfc program. I have a problem by the resolution of the icons in the designing procedure. When I open a designed icon, visual studio open it as 256 color image, however the original image has a higher resolution. Also, when I create a new icon visual studio sets its resolution as 16 colors.
How I can open the icon as original resolution or increase the resolution of an icon?
Please guide me to solve the problem.
Bests
|
|
|
|
|
|
That's not problem.
When you using your icon resource from source, there is not resolution problem occurred.
You can load your icon resource from files with LoadIcon function. You can see details from MSDN. That's all. 
|
|
|
|
|
After a long time guys, I am back to C++, however this time working as a tester.
I actually want some kind of tool for static analysis of the code, like checkstyle in JAVA. And I need that for Linux Platform and should be free.
What i mean by static analysis is, it tell you the coding style error, unused variable and function names
Gaurnag shah
modified 20-Nov-13 10:41am.
|
|
|
|
|
I have personally used two C++ static code analysis tools.
1. Visual Studio. I believe all SKUs of VS 2013 now include code analysis tools though the level of analysis in the Free express edition is not as nice as in the paid versions. Menu is: ANALYZE > Run Code Analysis on Solution.
2. Klocwork. We pay for a Klocwork license [^]. I'm not sure if they have a trial or free version available. A caveat: Klocwork does not handle C++/CLI code however so it skips the /clr files. We have a large body of portable plain C++ code so it works well with that code.
I'm sure there are other tools but C++ code analysis is difficult and most are expensive commercial tools.
John
|
|
|
|
|
http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis[^]
Most of the tools are commercial, but if it is your job, and you find that one of the commercial tools will notably improve the quality or speed of your work, you shouldn't have any problems convincing your boss to buy a license. The free ones I've tried are rather limited in scope and capabilities.
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)
|
|
|
|
|
When I read about delegate , I can figure out what that is and when we use that. But when I read about event , I mix things up and cannot find out how to understand the real difference and exact use of that in my codes. Every time I read about event , it gets more blur in my mind! Can you please explain that in a simple way? Thanks 
|
|
|
|
|
A delegate is like a function pointer, and event is like a function.
When an event is raised, it calls each delegate that is attached to it.
Events are generic in that they can accept delegates that point to any function, as long as the delegates ' signatures match the signature of the event .
Events are points of attachment for delegates to receive calls from an object.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I know a little in C++ world by reading some basic parts of C++ Primer book and doing simple stuff by C++. I'm about in the middle of the Microsoft Visual C++/CLI Step by Step and trying to reach a middle level in C++, the language I love. I like to write Windows apps including the traditional way and also Windows store. Do you have any advice or recommendation to me as an improvement, getting much better or so? Thanks guys 
|
|
|
|