|
I've suspected before, but this makes it certain - why do you feel the need for two CodeProject identities?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi stuart,
Sorry for this.. the issue when i stopped using the first id for longtime...i forgot the password so i have created the second one...but when i got to know the password of first id i started using both ....
|
|
|
|
|
I think, it's an abnormal behaviour. That is, every control should increase proportionally. May be, you know that sizes of dialog controls are in base units depending "a" font. At runtime, they are converted to screen coordinates (that is, in pixel) depending a chosen font. The system uses the average character width of the font to calculate the position and dimensions of the dialog box controls. The same should be applied to all controls. None has any size in any other units (except dialog units) before displaying. So increase or decrease should be proportional.
If not, those controls probably aren't standard windows' (pre-defined) controls. If they are customized, problem may be with their drawing, sizing (WM_SIZE) or setfont (WM_SETFONT) handler (if any).
|
|
|
|
|
No those controls were drag and dropped from the Toolbox...of the solution ...
|
|
|
|
|
Let me suggest this[^] codeproject article. Its all about resizing dialog box and controls.
|
|
|
|
|
Hi,
I need to write some code in C++ that will connect to an SQL table, run a query and then modify a text field in the SQL table if a condition is met. In the code below, if the Blend Status field = "APP" in the SQL table, I want to change it to "DNL". With the code below, I get the following error on the line "custatus.m_BlendStatus = "DNL";" when I compile:
error C2106: '=' : left operand must be l-value on the line "custatus.m_BlendStatus = "DNL";"
I'm not sure what the problem is or how to fix it. Any help would be appreciated.
Thanks in advance.
<pre>#include "stdafx.h"
#include "all_tool.h"
#include <atldbcli.h>
#include <string.h>
#include <time.h>
class CCUSTATUSAccessor
{
public:
TCHAR m_Id[50];
TCHAR m_RevisionId[50];
TCHAR m_BlenderId[50];
TCHAR m_BlendStatus[4];
DATE m_DateModified;
//output binding map
BEGIN_COLUMN_MAP(CCUSTATUSAccessor)
COLUMN_ENTRY(1, m_Id)
COLUMN_ENTRY(2, m_RevisionId)
COLUMN_ENTRY(3, m_BlenderId)
COLUMN_ENTRY(4, m_BlendStatus)
COLUMN_ENTRY(5, m_DateModified)
END_COLUMN_MAP()
};
CString BIName;
CString BIRevision;
CString BIStatus;
int ConnectOK = 0;
int a = 0;
time_t now;
HRESULT hr ;
hr = CoInitialize(NULL);
CDataSource ds;
CSession session;
CDBPropSet propSet(DBPROPSET_DBINIT);
propSet.AddProperty(DBPROP_AUTH_INTEGRATED, OLESTR("SSPI")); //Windows NT Authentication('SSPI')
propSet.AddProperty(DBPROP_INIT_CATALOG, "AmmDb"); //Database Name
propSet.AddProperty(DBPROP_INIT_DATASOURCE, "WOpenBPC"); //Computer Node Name
hr = ds.Open(_T("SQLOLEDB.1"), &propSet);
if(SUCCEEDED(hr))
{
ConnectOK = 1;
}
if (ConnectOK == 1)
{
hr = session.Open(ds);
if (SUCCEEDED(hr))
{
//Get the Blend Order Name and Revision
io.GetFromDatapool(BIName, DataLoc, "BlendOrderName");
io.GetFromDatapool(BIRevision, DataLoc, "BlendOrderRevision");
CCommand<CAccessor<CCUSTATUSAccessor> > custatus;
hr = custatus.Open( session, "Select * FROM CU_STATUS WHERE (Id = " + BIName + ") AND (Revision = " + BIRevision + ")" , &propSet);
if (SUCCEEDED(hr))
{
//Update the Blend Status when the blend is loaded to OpenBPC.
hr=custatus.MoveFirst();
if (SUCCEEDED(hr))
{
time (&now);
if (custatus.m_BlendStatus == "APP")
{
<b>custatus.m_BlendStatus = "DNL";</b>
hr = custatus.SetData();
custatus.Update();
custatus.m_DateModified = now;
hr = custatus.SetData();
custatus.Update();
}
else
{
custatus.m_DateModified = now;
hr = custatus.SetData();
custatus.Update();
}
}
}
}
}
else
a=1.0;</pre>
|
|
|
|
|
thebouge wrote: I'm not sure what the problem is or how to fix it. Any help would be appreciated.
There are a large number of Database Articles[^] here on CodeProject. Maybe you check them out.
|
|
|
|
|
My original sentence was a bit of a cop-out.
I think that the problem is that m_BlendStatus is defined as TCHAR in the class and that so it doesn't have the "=" operator defined for it. In other applications, I defined a variable as float instead of TCHAR and had no problems so I just assumed it would work the same with TCHAR. Is there another way to define this in the class so I can use the "=" operator to set the value in the SQL table or can someone share the correct syntax for updating the record?
Cheers.
|
|
|
|
|
thebouge wrote: Is there another way to define this in the class so I can use the "=" operator to set the value in the SQL table...
Since this is C++, why not just use a string object?
thebouge wrote: ...can someone share the correct syntax for updating the record?
I already suggested strcpy() (or a variant thereof).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thebouge wrote: custatus.m_BlendStatus = "DNL";
Use strcpy() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I deleted the .res folder of a VC++6.0 project by mistake. Now the project can not be load. I have the all *.h, *.cpp and a .clw file left. How to recover the .res folder and the whole project? The VC++6.0 project is MFC doc/view project.
Thanks!
Dan
|
|
|
|
|
Get the res folder from your source control system or, failing that, your backup...
Oh, what, you don't use either of those? You're (ever so slightly) screwed. You can get the default toolbar bitmaps and menus and string tables and things by creating a new project of the same type, but the dialogs you designed, the new menu entries you added, the toolbar buttons you created? They're gone.
Sorry to sound callous - but that's the way it is.
[edit] I just had a thought. Open the executable (presuming you have one) in Visual Studio - you can get a view of the contained resources and retrieve them from there (might be able to drag drop them into your project?
But - get yourself some source control and a backup - it makes sense, really. And you can get source control for 0$ - I use both Subversion and Git (through TortoiseSVN and TortoiseGit).[/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I guess the .rc file and resource.h would also be needed.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Ya - you could get blank ones of those from a blank project. I think the drag'n'drop of resources would fill in a reasonable amount after that, though.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Did you look in the Recycle bin?
|
|
|
|
|
I have been able to get this 3 to work.
Window1 and Window2 have 2 different handles to 2 different windows.
theApp.m_pThreads [0]=AfxBeginThread(Thread,Window1);
theApp.m_pThreads [1]=AfxBeginThread(Thread,Window2);
theApp.m_pThreads[0]->ResumeThread();
theApp.m_pThreads[1]->ResumeThread();
theApp.m_pThreads[0]->SuspendThread();
theApp.m_pThreads[1]->SuspendThread();
My problem is I don't want to create a thread for every window, How do I reuse the threads and change Window1 to Window3.
I have tried searching for it, being new I must have missed some articles. Would someone help me with this.
Thanks a million.
|
|
|
|
|
|
Thank you,
I will read on that. I guess i should find Thread pools on code project for samples and better explanation on it.
thanks a million.
|
|
|
|
|
if you can use Boost, there's a threadpool[^] extension which might help, too.
|
|
|
|
|
Simply. You can consider to pass a pointer to an object instead of Window1. The object that wraps window handle value, should be managable by your main thread.
class AClassName
{
public:
HWND hWindow;
};
AClassName* pACN new AClassName;
pACN->hWindow = Window1;
theApp.m_pThreads [0] = AfxBeginThread(Thread, pACN);
Then you can refer to pACN->hWindow in your thread function appropriately.
You may have to employ some synchronization technics, too.
|
|
|
|
|
You can use PostThreadMessage to pass in the window handle to the thread to switch from one window to another.
And never pass the window object from one thread to another. Always pass the window handle and attach it to a new window object using CWnd::FromHandle inside the thread. A window handle and its object is managed by MFC using a map which is valid only for the current thread.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
It seems that will be my best choice for now. I can't find any articles or demo's on a thread pool using vc++. All I have seen so far are in C#.
|
|
|
|
|
Hi all,
Is it ok if we write thousands of key-value entries into registry? How it will effect the performance of the system? Please suggest me..
(i know, this question is not related to this forum, but, i dont know where can i get exact information about this. i googled before posting the message to this forum, but, could not get proper information )
|
|
|
|
|
ramana.g wrote: Is it ok if we write thousands of key-value entries into registry? How it will effect the performance of the system? Please suggest me..
Probably not a good idea. Why not put them in a file, maybe (something like) a SQLite database or an XML file?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Registry size is limited (to 25% of the paged pool). this can be changed by the user, though it's not obvious to most people how to do it. so, it's probably much better if you just write your data to a file.
|
|
|
|