|
I like adding a shortcut to C:\Documents and Settings\<CURRENT_USER>\Start Menu\Programs\Startup so that they can remove it easily with the start menu
or add a key to
hkey_local_machine\software\microsoft\windows\currentversion\run
|
|
|
|
|
Mark Petrik Sosa wrote:
hkey_local_machine\software\microsoft\windows\currentversion\run
Usually you may not have write permission to "hkey_local_machine", suggested way is to use hkey_current_user.
suhredayan There is no spoon.
|
|
|
|
|
Hi!
I have a listbox that I'm adding content to, and I'd like to have it automatically scroll to the bottom any time new content is added. How might I do this?
Thanks!
|
|
|
|
|
Nevermind, I figured it out.
For those who might ever wonder:
Just use SETCARETINDEX to the index = LB_GETCOUNT
Thanks!
|
|
|
|
|
Hi,
does anyone know, how to get rid of the border of an ComboBox?
I've tried to remove all styles wich are handling with borders, e.g. WS_BORDER, WS_EX_CLIENTEDGE, WS_EX_DLGMODALFRAME and so on, but there isn't any change.
Whith ohter controls, like an Edit, it works.
Overriding OnPaint, and drawing the whole ComboBox myself, is not very useful, althought I can paint it without a frame, I still can't use the whole area of the control (except the pusbutton of coarse) for text, because the boarders are still there, but invisible.
Any other ideas???
Thanks in advance
|
|
|
|
|
1)I converted the MFC TCP server into non mfc TCP server using winsock.h.
It complies and runs but it does not performs efficiently as the server thread is not created properly in the non mfc statment of _beginthread and CreateThread
Plz modify the code so that it runs smoothly thanks
2) what i have to do to make UDP server?
3) how can i change it into mutithreaded server( that accpets connections from many threads?)
#include process.h
#include windows.h
#include iostream.h
#include conio.h
#include winsock2.h
/* _beginthread, _endthread */
#include stddef.h
#include stdlib.h
unsigned int ServerThread(LPVOID pParam);
int main(int argc, char* argv[])
{
HANDLE hThread;
unsigned long iID;
cout<<"!!hello world!!\n";
LPVOID var=0;
//unsigned int block=0;
//block=ServerThread(var); //Call to the function
// _beginthreadex( ServerThread, 0, NULL );
hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE )ServerThread,NULL,0,&iID);
//_beginthread(ServerThread, 0, NULL );
// hThread = (HANDLE)_beginthreadex( NULL, 0, &ServerThread, NULL, 0,
// &iID );
cout<<"\n\nyahoo";
// while(getch()!=27);
// getch();
return 0;
}
unsigned int ServerThread(LPVOID pParam)
{
cout<<"Hello from thread";
SOCKET server; //Socket is unsigned int
WSADATA wsaData;
sockaddr_in local; // Structure variable
int wsaret=WSAStartup(0x101,&wsaData); //Initialization
if(wsaret!=0)
{
return 0;
}
|
|
|
|
|
Dear all,
I have quite a lot of questions about using CString in MFC correctly. Hope you can help me.
1) In VC++ documentation, it says "You can freely substitute CString objects for const char* and LPCTSTR function arguments." What is it meant? Is that I can safely pass CString object to functions that accept argument const char* or LPCTSTR (LPCSTR)?
For example, I have a function void testfunction1(const char* input1);
Can I call this function by:
CString s = "c:\\program files";
testfunction1(const char* input1);
2) For the Format function of the CString class, the VC++ documentation says "The call will fail if the string object itself is offered as a parameter to Format". Is that we cannot use the Format function in this way?
For example, Can I use the following codes safely?
CString test1 = "c:\\program files\\";
char folder[10] = "folder1";
CString FullPath;
FullPath.Format("%s%s", test1, folder);
Will FullPath be "c:\program files\folder1" ?
If I cannot use this method to for setting FullPath, what should I do to set the FULL path correctly?
3) Is the CString object NULL terminated?
4) What is the maximum number of characters for the CString object?
5) What is the meaning of "const" in the function argument?
eg. void thisfunction(const char* test, int test2);
Thanks all of your help.
|
|
|
|
|
tttyip wrote:
For example, I have a function void testfunction1(const char* input1);
Can I call this function by:
CString s = "c:\\program files";
testfunction1(const char* input1);
Close. What you meant was:
CString s = "c:\\program files";
testfunction1(s); tttyip wrote:
2) For the Format function of the CString class, the VC++ documentation says "The call will fail if the string object itself is offered as a parameter to Format". Is that we cannot use the Format function in this way?
For example, Can I use the following codes safely?
CString test1 = "c:\\program files\\";
char folder[10] = "folder1";
CString FullPath;
FullPath.Format("%s%s", test1, folder);
Will FullPath be "c:\program files\folder1" ?
If I cannot use this method to for setting FullPath, what should I do to set the FULL path correctly?
What it means is that the following is unsafe:
CString test1 = "c:\\program files\\";
test1.Format("%s%s", test1, "some other text"); You must cast the CString argument as LPCSTR like:
test1.Format("%s%s", (LPCSTR) test1, "some other text"); tttyip wrote:
3) Is the CString object NULL terminated?
You are confusing the object itself with the internal buffer that it maintains. When using CString , you mustn't think of it as a glorified char type. Let the object handle its internals, and you simply interface with it using the supplied methods.
tttyip wrote:
4) What is the maximum number of characters for the CString object?
Up to INT_MAX characters.
tttyip wrote:
5) What is the meaning of "const" in the function argument?
eg. void thisfunction(const char* test, int test2);
It declares a pointer to a constant character, meaning that you cannot change the character.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Help Required
Is it possible to insert a dialog and its code and controls into another VC++ project file!! If yes how is it done!!
Thanks
|
|
|
|
|
This is possible, probably a number of ways. I like to take the destination project and add the resource file. So that I have two resource files, from here you can copy and paste the dialog that you want. Then just take the header and cpp file associated with that class and add it to your project. Bam your good.
|
|
|
|
|
I have been working on this problem for a couple of days kow and i cant seem to get it can somebody please help me. The problem is :
Write the program that generates the pattern below. Allow the user to call functions to generate the top triangle, bottom triangle or the complete pattern.
_________ 1
________2 1
______3 2 1
____4 3 2 1
__5 4 3 2 1
____4 3 2 1
______3 2 1
________2 1
__________1
i just put the lines there so it wouldnt move over
i would deeply appreciate it if somebody can help we with this.
|
|
|
|
|
What have you done so far and what did it give you?
|
|
|
|
|
i got it to output stars but only in the top half of the triangle. Cause i couldnt get it to output the numbers
|
|
|
|
|
I've written a program that interfaces to a web page (basically a POST followed by reading the response).
I would have thought that if the web page sends a cookie, and then requests it back later, this would all be handled automatically. But it doesn't seem to work.
Can someone point me in the direction of some code that might do what I want?
Neil
|
|
|
|
|
Is MSDN article Q168864 of any help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Not really. It covers ISAPI, and I'm writing a client (in MFC).
WHenever I read from the server I only get the data, not the headers. I presume there is a way to also get the headers and I can do cookie management myself, but I would have thought it would be automatic (or at least optionally automatic).
|
|
|
|
|
I have the following code using GDI+. There is a weird error when I compiled it.
#include <gdiplus.h>
using namespace Gdiplus;
...
Bitmap* b = new Bitmap(100,200);
...
The compiler says:
...\TClientSimpleView.cpp(151) : error 2660: 'Gdiplus::GdiplusBase::operator new' : function does not take 3 arguments.
Do anyone know what happens? Is it a bug in GDI+?
Thanks.
Lei
|
|
|
|
|
It is the difference between new and DEBUG_NEW . A workaround is to always use the global ::new operator for GDI+ objects.
Bitmap* b = ::new Bitmap(100,200);
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I am trying to figure out how to transfer text from one form to another using a textbox. I am using Visual Studio .Net. I am also using Windows Forms in Visual C++.
Bobby
|
|
|
|
|
Are you using WinForms here - in which case you're actually using Managed C++, or the old dialog editor - in whch case you're using Visual C++. The approach is very different!
In WinForms if you have a TextBox object, you can get and set it's text with the text property. E.g:
textBox.Text = "Hello";
textBox2.Text = textBox.Text;
In Visual C++ if you're using MFC, then you can write something like this:
CString string;
GetDlgItem(ID_EDIT1)->GetWindowText(string);
GetDlgItem(ID_EDIT2)->SetWindowText(string); Hope that helps you.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
|
The gdiplus.h file is included with the Platform SDK. Download it from Microsoft's site. I am not familar with the graphics.h file. It sounds like it might have been shipped with the Turbo C or Borland C compiler.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
graphics.h file. It sounds like it might have been shipped with the Turbo C or Borland C compiler.
Exactly. You may still be able to download a free version of Borland's c++ compiler here www.borland.com[^]
The file should be with the free compiler.
John
|
|
|
|
|