|
I am a beginning C++ programmer. My long-term goal is to write Windows-based business applications with relatively sophisticated GUI. For now, though, I am looking for (a) sample source code that demonstrates how to create and manipulate simple Windows objects -- such as menus, windows, dialog boxes, buttons, etc. Alternately, I am looking for (b) an "application framework" with which I can experiment, to create some basic applications in a short time.
I'm currently using Bloodshed's "Dev-C++" compiler, but plan to start developing on the Borland "C++ Builder 5.0 Standard" platform soon. (c) Is this a mistake? Should I get started with Microsoft's "Visual C++," or some other platform altogether?
Any guidance is most appreciated. Thanks.
|
|
|
|
|
As this site is squarely aimed at MS-based products, and this forum is titled "Visual C++", it is unlikely that you're going to get a recommendation for Borland or Bloodshed over VC++.
Certainly MFC (part of Visual C++) is the "application framework" you need in answer to (b). To just create and manipulate simple Windows objects (a), though, you could just use Win32 API (which presumably is supported by Bloodshed and Borland). Examples can be found in the Platform SDK documentation at www.microsoft.com
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I started with Borland, but now I do VC++ only. I suggest you start with Visual Studio as your first environment. There is nothing wrong with Borland and OWL, but there are so much more samples in MFC around, making it easier to learn.
/moliate
|
|
|
|
|
I'd say use VC++ as well. You'll be more in demand commercially and there's more help/samples/info about for it. Get a copy of Petzold (Programming Windows) as well and if you do go MFC later get Prosise (Programming Windows with MFC)
i1.2sqrt(u).bcos(ur)sec(c)
but
b4.isqrt(u).ru/16
Navier
|
|
|
|
|
I have a problem with a simple c++ console program.
I want user enter a string to enter their name, if user enters nothing like a enter key, the blank data should be caught and an error message should be print out on the console.
what I did was I declared a string name, then use name.lenght() function and compare it with 0, if(name.length()==0), but this cannot catch the enter key. Then I tried getch(), it catches enter key but it is not a string. What shall I do?
Thanks!
padgyx
|
|
|
|
|
You can use fgets. If the string has whitespace or a newline then nothing was enterred and you have an error.
|
|
|
|
|
If you are using getch() you can always catch the Enter key(0x0D) this way...
.
.
.
char key;
key = getch();
if(key == '\n')
{
.
.
cout<<"You pressed Enter"<<endl;
}
.
.
Atul
Sonork 100.13714 netdiva
|
|
|
|
|
Hi, Atul:
I tried this getch(), it works, but char key can only input one char at a time, what I want is a string or at least a c_str as the input. However, if I use string or c_str, then catching the enter key (a blank) is a problem. It seems that only getch() can catch the enter key. If I use the first element of c_str to check the enter key, it does not work.
I will try the fgets().
thanks.
|
|
|
|
|
You could just use gets().
char szInput [INPUT_SIZE];
gets (szInput);
if (strlen (szInput == 0)) {
;
}
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks Ravi:
I will give it a try.
It seems that my thread cannot roll back to the front of the forum even I reply or update the message at latest time. How can I come to my thread to view other people's comment more easily?
Another forum, Javaranch.com, can roll back your thread to the front if you reply the message at latest time.
Thanks.
pad
|
|
|
|
|
Ravi:
It works now. Thanks a lot!
Do you know anyway that I can use string directly instead of a c_string? Or do you know how to convert a c_string to a string? Sorry about my dum questions.
padgyx
|
|
|
|
|
What type of control would be best suited for use as the editable icon display in an icon editor?
K
|
|
|
|
|
Anonymous wrote:
What type of control would be best suited for use as the editable icon display in an icon editor?
I dont think any windows control comes near the required functionality. So just create a window and handle all the required mouse messages and painting accordingly. In MFC you might derive a class from CWnd and write your own custom control.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
What I sometimes do for this kind of stuff is start with a CStatic. It has very limited functionality anyway, but you can draw it on a dialog in the dialog editor and get your layout sorted nicely.
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I have big array (about 1 000 - 100 000 items) . How can I detect what memory the app occupy ??
(Iam finding the best solution to store items in memory.)
|
|
|
|
|
Wizard_01 wrote:
I have big array (about 1 000 - 100 000 items) . How can I detect what memory the app occupy ??
That depends on the type of array. If it is an array of bytes, a 100,000 size array would be 100,000 bytes. If it is an array of objects or structs, then use sizeof to find the size of that object and multiply by 100,000.
Example :- for an array of type myStruct
tot_mem_reqd_for_array = array_size * sizeof myStruct
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Wizard_01 wrote:
I have big array (about 1 000 - 100 000 items) . How can I detect what memory the app occupy ??
For getting memory occupied by array you can use the sizeof operator.
int array[] = { 100, 200, 300 };
size_t sizearr = sizeof( array );
Atul
Sonork 100.13714 netdiva
|
|
|
|
|
Hi
I hope someone of you is able to solve my problem.
What I want to do is to write a plugin for the InternetExplorer (a so called BHO - Browser Helper Object) that will modify the HTML content before InternetExplorer displays the webpage.
I already wrote a plugin which will catch the DWebBrowserEvents2::DocumentComplete event. This is my code which works so far:
HRESULT __stdcall CCounter::DocumentComplete(IDispatch* pDisp, VARIANT * URL )
{
ATLTRACE(_T("CCounter::DocumentComplete\n"));
return S_OK;
}
What I now want to do is a bit complicated:
Before the browser is about to display the webpage I want to get access and to the document's content and modify it (e.g. for removing keywords previously defined in an external file)
I hope someone of you can help me, since it is a question which can't be explained in 1 minute.
Thanks in advance
regards
Gregor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
When the DocumentComplete event is sent, a great deal of rendering is already done. This will not prevent you from modifing the document "on the fly". What I would suggest is the following:
1) QueryInterface pDisp for the IWebBrowser2 interface (or call Invoke directly)
2) Use IWebBrowser2::get_Document to get a pointer to the (Dispinterface of; QueryInterface again) IHTMLDocument2. If the document contains frames you have to find the interface for each frame, and repeat step 3 for each of them.
3) Get the body element and send it to an recursive function that handles each leaf element (gets/puts outer text). It then finds all element children and feed them back to the function.
This is just an suggestion, and perhaps someone has a better solution. Sorry if I don´t go into all technical details, but I hope this will help a little.
/moliate
|
|
|
|
|
As I recall from my prevous experience on close to that issue:
DocumentComplete Event may not be always fired... So, check Refresh for example... I recall it didn't work for me... But again, it could be previous versions of WebBrowser...
Everything else as rightly described in previous message...
GL
Igor
|
|
|
|
|
Hi, I tested the atol() function. This line works fine:
char buffer[] = "1234567890.12";
long number = atoi(buffer); // number = 1234567890;
but here is problem after I added the following lines:
buffer[10] = '\37'; // buffer = "1234567890712" now
number = atoi(buffer); // return value is 1912276760. why?
thank you very much for your advice!
|
|
|
|
|
sorr, typing error:
buffer[10] = '\37'; ==> buffer[10] = '\x37';
|
|
|
|
|
A long is a 32 bit number.
The biggest it can store is 4294967295
1234567890 < 4294967295
But
1234567890712 > 4294967295
That's why you get this overflow error.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Ah, I see. Thank you, Nish.
|
|
|
|
|
I'm trying to figure out how this beast is supposed to work to be able to show popup contextual help windows?
The tech-writter gave me a help.chm file that has a [TEXT POPUP] section in it with the text file that contains all the contextual help descriptions like :
context.txt :
.topic HID_TOPIC_DO_SOMETHING
This functionnality will do something
and context.h :
#define HID_TOPIC_DO_SOMETHING 4567
in my program I'm doing the following:
HH_POPUP popupText = { sizeof(HH_POPUP),
theApp->m_hInstance,
4567,
NULL,
{100, 100},
(DWORD) -1,
(DWORD) -1,
{-1, -1, -1, -1},
NULL
};
::HtmlHelp(m_hWnd,helpFile, HH_DISPLAY_TEXT_POPUP ,(DWORD) &popupText);
But it doesn't work really well, it doesn't work at all, I don't know exactly what happening, but the topic is not found!
Is this supposed to work ? Should it be used ? the documentation in MSDN is not really usefull, and what I could find on the web, wasn't really usefull either!
If you have any hints, tips or additional resources for this I'd appreciate !
Thanks!
Max.
|
|
|
|