|
What kind of verification does vim ?
I am asking such a question because, I believe, while it is not straightforward closing vim , there could be better alternatives to 'verify networking'.
|
|
|
|
|
I wondered about that too: if the point is just to verify that you can access a certain file across a network file path, then trying to open it with fstream::open() should do the job.
Whereas, emulating console input that is supposed to be passed into an external process would be kind of tricky, to say the least...
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 am just looking to verify "hosts" names.
And I realize that using vim is asking for complications, especially when I actually need to use / select "name" for further processing.
vim is bad idea.
|
|
|
|
|
If vim is not in insert or append mode then you can close it by sending ZZ.
|
|
|
|
|
OK, I can do search and replace "cout<<" with "cout<< setw(offset)<< "
to shift the output start column to console at offset.
BUT
anybody has an idea / hack how to PRESET "cout" ?
<pre> int offset = 10;
setw(offset);
cout << setw(offset ) << "Test " << endl;
cout << setw(offset ) << "Test " << endl;
cout << setw(offset ) << "Test " << endl;
offset += 10;
cout << setw(offset ) << "Test " <<" space " << "Test " << endl;
cout << setw(offset ) << "Test " <<" space " << "Test " << endl;
cout << setw(offset ) << "Test " <<" space " << "Test " << endl;
cout << setw(offset ) << "Test " <<" space " << "Test " << endl;
|
|
|
|
|
No, The width feature affects the following item only. In the same way you cannot have a preset in printf.
|
|
|
|
|
Usually when doing that sort of thing its easier to swing to ANSI which is semi portable on Windows and Linux consoles and you can have colours. Still cant set it global pre calls.
An example
printf("\x1B[%d;%df\x1B[31;40mRed line at 10,20\n", 10, 20);
printf("\x1B[37;40m");
In vino veritas
|
|
|
|
|
Leon,
I am getting used to using cout, despite of its irrational behaviour.
In my main project I went overboard with debugging colouring scheme and it sort of works.
I just started the "client" part of the project and reusing a class from my main project where cout colouring and cout lines work just as expected.
In derived project - no coloring, cout lines have extra line feed and I am getting non printable characters to boot.
Just another bug to find.
BTW
I am finding out this setw does not always work....
|
|
|
|
|
Vaclav_ wrote: I am finding out this setw does not always work More likely, you are finding there are bugs in your code.
|
|
|
|
|
|
That is little out of my league, but when I have a break I'll give it a try.
|
|
|
|
|
how to use LoadString in c++
|
|
|
|
|
The Windows API LoadString() expects a buffer, not a C++ string. The easiest way to use it would be something like:
std::wstring GetStringW(HINSTANCE hinst, UINT id)
{
std::vector<wchar_t> buffer(256);
::LoadStringW(hinst, id, buffer.data(), static_cast<int>(buffer.size()));
return &buffer[0];
}
which would convert the buffer into a std::wstring.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
|
Hi
I have a bitmap file of a red bullet Originally I tried to display it using RichEdit Ole Interface I copied the code modified it somewhat from
the "Q220844: HOWTO: Insert a Bitmap Into RTF Document Using RichEdit Control" I was able to display it however it didn't fit quite right
So I decided to go with a native Win32 and display on Static control adjacent to the rich edit
Thing is where the OleCreateFromFile worked the LoadImage API fails GetLastError return a zero as well using File Explorer I can see the red bullet
Thnaks
|
|
|
|
|
You aren't trying to load a jpg, gif or png are you .. loadimage does not support those it is strictly BMP and PCX.
If you need those just use IPic and for that all you need is #include <olectl.h>
In vino veritas
|
|
|
|
|
Are you referring to OLeLoadPicturefile BTW As I mentioned to Richard when I used the code example in the following article Quote: Q220844: HOWTO: Insert a Bitmap Into RTF Document Using RichEdit Control"
Even though I had a 1 in the first param of the SetSel the Red bullet didn't align itself right next the left border of the dialog box
In file explorer the image looked fine.
Opening up the image in Paintbrush I see a white rectangular border around the red bullet maybe that was part of the problem
I loaded the image by doing a google search is if this is the problem is there a way from get this image (I am trying to get something like the visual studio Breakpoint)
Thanks
|
|
|
|
|
So much confusion and misunderstandings to know where to start.
Lets start with SetSel misunderstanding which starts at 0 NOT 1 it is a zero-based index.
Very important is the file type you didn't say what the file was look at the last 3 letters of the filename is it BMP, GIF, JPG or PNG?
Yes if you have a white border the white border will be on the image UNLESS it is a transparent image which needs a special header and depends on file format (so again we need the file format).
You said you change the code over to LoadImage and I warned you that you can only load files that are of BMP and PCX type. That is files that end with those 3 letters and have a proper matching header. If you try to load a wrong type it does pretty much what you describe returns NULL with a GetLastError of 0 because it can find the file but it's just junk it can't understand.
So can we at least get a filetype to start with so we know what we are dealing with, so 3 letter filename extension please. If you can't see them on windows go up to view settings and tick the box that says file name extensions.
In vino veritas
|
|
|
|
|
I understand that LoadImage wont work, Let me ask the following if I use LineIndex(-1) then I am returned the char index on the line and its I ASSUME it is the first char index in that line that has the caret
Afterwards if I do GetCharPos using that value I get the x,y coordinates in pixels of that char so I would like to place my bullet there and x = 1 that it should lie all the way to the left of the rich edit control and yet its off (about 1/8 of inch) my only guess is when I display the bullet in paintbrush there is white rectangle around it
and that is what is pushing it off. what do you think
if this true would you know how I would go about getting a red bullet bmp/png like the breakpoint in Visual studio Debugger
Thanks
|
|
|
|
|
Well techinically it is x = 0 but there is nothing stopping you simply entering a negative x co-ordinate of a few pixels to allow for your white border.
The richedit like all windows knows how to clip
In vino veritas
|
|
|
|
|
I expect your code is wrong. But since you have not shown us what code you are using it is impossible to say more.
|
|
|
|
|
|
You will need to provide much more information before anyone can help you with this. You say that it shows junk values; what are those values and why are they junk? What is the code that produces them, and what input data is used to create the values in the first place?
|
|
|
|
|
Richard
Here is the statement
HANDLE hBmp = (HBITMAP) LoadImage(AfxGetInstanceHandle(), _TEXT("C:\\DriveRichEdit\\DriveRichEdit\\DriveRichEdit\\res\\bullet_red.png"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
As leon mentioned LoadImage may not work with .png files
I am trying to emulate Visual Studio Debugger Breakpoint, when I used the RichEdit OLE interface and look at the SetSel parameters I see the first value (The x value as 1) however is stands away from right edge of the Parent Dialog frame (maybe by 1/8 of inch).
Looking at the image in file explorer it looks just fine but when I am open the image in paintbrush I can see a rectangular white border around it and maybe that is part of the problem. If that is a problem would you have any suggestion for me how to get an image ie. red bullet, I picked this one up by doing a google search thanks
|
|
|
|
|
Most likely your code relies on a variable being zero or a BOOL false which you haven't specifically set to zero/false.
Look at all your variables which require a preset zero value and make sure you set them.
When you run in debug mode because it is going to display things it first zeros all variables, that does not happen when you run in normal mode.
This for example will print 0 in debug F5 mode but could print anything in normal ctrl-F5 mode because i is not set
int i;
printf("i = %i\n", i);
In vino veritas
|
|
|
|