|
Setting the window active. Sorry, should have been more clear. The program is already running, I just want to make it the active window.
-Dev578
|
|
|
|
|
You will need to get the HWND of the other window. You can do this several ways, either by calling EnumWindows once you have defined a EnumWindowsProc callback or use FindWindow to get the HWND .
- Nick Parker My Blog
|
|
|
|
|
I am using this code
while (ERROR_SUCCESS == RegEnumValue(theSettings._rgk,dwIdx,szValueName, &dwValueNameLen,NULL,&dwType,(LPBYTE)buff,
&dwSize))
{
pairVec.push_back(std::make_pair(_bstr_t(szValueName),_bstr_t(buff)));
dwIdx++;
}
i have 5 entries in the registry, the above loop only finds the last one and
then exits.....
can any1 help?
thanks
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
You need to reset dwValueNameLen and dwSize to the sizes of your buffers before each call to RegEnumValue()
--Mike--
Personal stuff:: Ericahist Updated Feb 6! | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2
Pinky, are you pondering what I'm pondering?
I think so Brain, but how will we fit the hamster inside the accordion?
|
|
|
|
|
thanks
works like a charm
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi..
i am developing an vc++ application that manage files
(copy ,move and rename)and i am useing the CFileFind
class but an error keep arise each time i make run
error name:assertion failures
in line 354 which is
void CFileFind::AssertValid() const
{
if (m_hContext == NULL)
ASSERT(m_pFoundInfo == NULL && m_pNextInfo == NULL);
else
(354) ASSERT(m_pFoundInfo != NULL && m_pNextInfo != NULL);
}
i read a bout it in the help but i still can not solve it ..
so an idea to help me..
|
|
|
|
|
Post the code that makes use of CFileFind.
Kuphryn
|
|
|
|
|
Dear Friends,
I am new here visiting this site and this is my first question.My question is:
Print Manager should display the default paper size in paper
size listbox.
|
|
|
|
|
Is there a freeware that will help in visualizing the call flow in a C++ progrem? I have to maintain a C++ program written by another person. What are the tools that will simplify my understanding of the program?
|
|
|
|
|
Hello everyone, I hope you all can help me with my problem .
I decided to learn C++ because of it's power and because it's cross platform (I guess the typical reasons). I use Windows so that will be the platform I will be programming for until I learn enough to venture to other platforms. It seems everything related to Windows programming is going to managed .Net code. In light of this, what is the best way to learn C++ the language, not a platform or framework? As I understand from similar posts, in order to learn C++ for any platform, one must learn the language then the interested platforms/frameworks. Should I look into tools by Borland, use Visual Studio 6, or Visual Studio.Net? What books should I read? I am just generally confused on the process of learning C++ when the platform I will be programming for is making a drastic change. :P Any input on the learning process will be extremely helpful.
Lonnie
|
|
|
|
|
Generally, it does not matter what platform you work under when programming in C++ because each platform requires extensive knowledge and experience with the C++ language. Just pick a platform and learn it well. Then move to another platform. The key is to not jump around until you have mastered a platform.
Kuphryn
|
|
|
|
|
While it is true that Longhorn promotes managed code, there is backward compatibility the Win32 API. Without it, I don't think anyone would upgrade to Longhorn to see hundreds (or thousands) of dollars of legacy software not run on their new system. Also, just look on this site...there is a lot of good public domain C++/MFC code that likely won't be "ported" to managed code anytime soon. There are a lot of solidly written apps that rely on MFC which would be expensive to rewrite in managed code. So while it is true that MS is pushing the industry hard in the managed code direction, it has to overcome a tremendous amount of inertia. The history books haven't been written yet. So don't worry, start with learning the core C++ language (many good books) including standard C/C++ library and STL. The direction you take from there can be many depending on your goals (i.e Win32 API, MFC, .NET, WinFX, device drivers/Native API, COM/ATL, etc.).
|
|
|
|
|
Thanks to both of you for replying. Your answers helped a great deal. Now it's time to get busy. But one thing though. In light of the fact unmanaged code isn't going anywhere anytime soon and it's the language that counts, does it really matter what version of Visual Studio I use to learn or program in C++? I have Visual Studio 6 Pro and would rather invest in books and learning material than another IDE. Besides, all the books I've looked at for C++, the language not MS Visual C++, have never said anything about what tools or compiler to use and that confused me too.
Lonnie
|
|
|
|
|
Many introductory C++ programming books try to stay platform/compiler independent. So you are left figuring out your IDE on your own. Or worse yet, if you don't have an IDE then you will have to figure out how to build on the command line...ouch! Okay, I admit I tinker around with gcc but only for fun of it.;P
I use VS .NET Pro 2003. Whether you use the .NET framework or not, in my opinion, this is a major improvement over the VC 6.0 for several reasons. Its compliance with the ISO/ANSI C++ Standard is just shy of 100%. Improved Intellisense. Improved debugger. Improved class browser (includes base classes, marcros, message maps). Improved IDE. More stable. MFC 7.0 is improvement over 6.0. Probably other reasons I can't think of right now.
VC 6.0 is fine for learning the language, though. If you were going to buy one thing, I highly recommend Visual Assist from Whole Tomato (www.wholetomato.com). It's worth its weight in gold. You can still get the VC 6.0 version.
|
|
|
|
|
hi guys
Im doing an apllicaton in Visual C++. Totally new at it. I need to retrieve information from the database to populate the combo boxes. How do I go about doing it?? Im using a ODBC connection and Microsoft Acess. I dont know what other information i have to provide.
Hope you can help me on this.. =)
|
|
|
|
|
If you are completely new to database programming with Visual C++ and MFC, I suggest you start a reading tour from the MSDN Library.
Here is a link to the index file: click me[^].
In bottom, database programming consists of three parts: first, opening a connection to a data source. Two, executing one or more queries on the source and handling the resulted rows. Lastly, closing up and cleaning.
Knowledge of structured query language (SQL) is very useful, because for example Access is capable of responding to SQL queries.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi!
Im writing an application using visual c++. I need t set up the DSN dynamically... how do i go about doing it? im using Access and ODBC connection... How do i go about doing that???
any help is greatly appreciated! =)
|
|
|
|
|
If in any way possible, use a DSN-less connection.
Creating DSN entries in the ODBC manager is a REAL pain in the ass, and when/if your application is uninstalled, you must remove these entries, which is even more difficult.
Here is a useful article on writing DSN-less connection strings for ODBC data sources: http://www.able-consulting.com/ADO_Conn.htm
The key logic here is firstly enumerate the available data source drivers on the local machine. If a driver is found, the appropriate connection string is issued. If you need added security, you can create the connection string on the fly, and store the username/password in an encrypted string table entry or something similar. Naturally, when the connection string is used, it is posted in clear-type, which creates a possible security risk. This can be avoided, if necessary, by prompting the user to enter a username and password each time an attempt to open the data source is made.
If, however, you are forced to create a DSN programmatically, there is an MSDN Library article available in here[^].
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi everyone,
Now I'm writing a LaTeX IDE and facing problems with structures parser problem. I'm implementing the the feature of parsing the structure of a project (from multiple files) and produce a hierachy structure.
Anyone can give me suggestion of framework, what need to be done, ...
Best regards.
|
|
|
|
|
hi..
i am working know on project where i build an vc++ application to allow interaction between local server and a client but now i would add a part where two clients can communicate .
so my question is what is the function i will use to define the user name and password for each host to access the client
thanks
|
|
|
|
|
Do you want the user authentication to be done by windows? Otherwise you handle this yourself by saving username / password pairs in a file (hopefully it is encrypted) on the server.
John
|
|
|
|
|
thanks i will try the secound solution
|
|
|
|
|
I am having problems deleting a char string that I created with a new function and added to a node template to use within a double linked list (also a template). I create a string copy the contents into it than add the pointer to a new node item. Later when I pull the string back out and try to delete the string or the node, I get a debug error: "DAMAGE: after block (#53) at mem address". Here is a sample of the basic code.
void TestFunc()
{
char cIn[80];
char *pStr = NULL;
CDblList<char> pList;
bool bDone = false;
while(!bDone)
{
cout << "\n Input Text (E to exit): " << flush;
cin >> cIn;
if(stricmp(cIn, "E") == 0)
break;
pStr = new char[strlen(cIn)];
strcpy(pStr, cIn);
pList.AddNodeToTail(pStr);
if(pList.GetCount() > 0)
{
pStr = pList.RemoveHead();
cout << " Removed from head: " << pStr << endl;
delete [] pStr;
while(!bDone)
{
pStr = pList.RemoveTail();
if(pList.GetCount() + 1 > 0)
{
cout << " Removed from tail: " << pStr;
cout << "\t Count: ";
cout << pList.GetCount() + 1 << endl;
delete [] pStr;
}
else
{
pList.Flush();
bDone = true;
}
}
}
}
//////// Different header file
template <class t=""> class CDblList; // Forward declaration
template <class t=""> class CNode
{
private:
T* pVal;
CNode<t>* pNext;
CNode<t>* pPrev;
public:
CNode() : pVal(0), pNext(0), pPrev(0) {;}
~CNode(void)
{
pVal = NULL;
pNext = NULL;
pPrev = NULL;
}
friend class CDblList<t>;
};
template <class t=""> class CDblList
{
private:
CNode<t>* pNode;
int iCount;
public:
CDblList() : pNode(0)
{
iCount = 0;
pNode = new CNode<t>;
}
~CDblList() { Flush(); }
void Flush()
{
if(pNode)
{
CNode<t>* p = (CNode<t> *) pNode->pPrev;
pNode->pPrev = NULL;
while(p != pNode)
{
p = p->pPrev;
delete p->pVal;
delete p->pNext;
}
p = NULL;
}
iCount = 0;
}
void AddNodeToHead(T* pItem)
{
if(!pItem)
return;
CNode<t>* p = new CNode<t>;
p->pVal = pItem;
if(iCount == 0)
{
pNode->pNext = p;
pNode->pPrev = p;
p->pNext = pNode;
p->pPrev = pNode;
iCount ++;
}
else
{
p->pPrev = pNode;
p->pNext = pNode->pNext;
p->pNext->pPrev = p;
pNode->pNext = p;
iCount++;
}
}
T* RemoveHead()
{
CNode<t>* p = pNode->pNext;
char *pRet = NULL;
if(!p)
return NULL;
else
{
pNode->pNext = p->pNext;
p->pNext->pPrev = pNode;
pRet = p->pVal;
p->pVal = NULL;
iCount --;
if(iCount >= 0)
delete p;
}
return pRet;
}
int GetCount() { return iCount; }
};
A couple of other notes. A couple of functions have been removed to save space. They have nothing to do with adding removing information, unless it is a duplicate of a similar function but operating in the reverse. The linked list is doubly linked and circular. The app is meant to avoid windows headers and is using only <fstream.h> and <string.h>. This is a console app that I amtrying to build and run on an NT based system. I am compiling under VC 6.0. By the way, I don't get any errors saying that I didn't cleanup memory when I comment out all the delete functions.
Thanks for any assistance in helping see what I am doing wrong. I am doing this to learn and understand templates.
Leo T. Smith
|
|
|
|
|
"Damage after block" means you allocated some memory and then wrote past the end of the allocated block. From a quick glance, this looks like the culprit:
pStr = new char[strlen(cIn)];
strcpy(pStr, cIn); You need to alloc 1+strlen(cIn) char s to account for the terminating null.
--Mike--
Personal stuff:: Ericahist Updated Feb 6! | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
I am getting the classic "Object reference not set to an instance of an object." error inside a System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) call.
Before you tell me the canned response about null references, here is the trace:
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at eCandidus.Master.Main() in C:\Enterprise Candidus\eCandidus\eCandidus\Master.cs:line 104
The error happens randomly while scrolling a dropdown list combo box, and happens in different combo boxes in different forms. Note that is being caught in a last resort try/catch at the very outmost call posible.
Anyone run into this one before?
|
|
|
|