|
I have created an ownerdraw listbox with the following Style.
pco_VerifyListBox->Create(LBS_HASSTRINGS|WS_CHILD|WS_BORDER|LBS_MULTIPLESEL
|LBS_EXTENDEDSEL|LBS_STANDARD,rect,GetParent(),GetDlgCtrlID()+ 4000);
it shows Error after the following line.
pco_VerifyListBox->SetVerifyList(pco_VerifyList);
SetverifyList Function has the following Defn..
----------------------------------------------------
void ct_VerifyListBox::SetVerifyList(
ct_VerifyList * pco_list)
{
assert(pco_list);
pco_VerifyList = pco_list;
ResetContent();
for (unsigned u = pco_VerifyList->FirstCond(); u; u = pco_VerifyList->NextCond(u))
{
AddString(pco_VerifyList->GetData(u).co_Item.GetCharPtr());
}
SetCurSel(0);
----------------------------------------------------
it gives Debug assertin in the AddString line..
It is from the MeasureItem funtion of the class CListBox.
also the program crashes...
what will be the solution for this problem?
|
|
|
|
|
Sorry Friends,,
There is a mistake in my posting..
the correct create statement in my code is
pco_VerifyListBox->Create(LBS_HASSTRINGS|WS_CHILD|WS_BORDER|LBS_OWNERDRAWVARIABLE
|WS_HSCROLL|WS_VSCROLL,rect,GetParent(),GetDlgCtrlID()+ 4000);
but the problem is the same...
pls tell me a solution.
Abul Fasal .N
|
|
|
|
|
Hi,
I need to connect to a DSN (data source name) via ODBC without writing the UID and password into my code in C++.
Has anybody an idea how to solve this issue?
Thanks.
|
|
|
|
|
What I'm about to say is doubtless obvious but... if you don't want to hardcode uid/pwd in your program, then you have no other solution than getting them from an external source (file, user input, registry, etc.)
|
|
|
|
|
Perhaps you could ask the user to input them at runtime.
Sorry already suggested.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
SuzannaS wrote:
Has anybody an idea how to solve this issue?
It depends on the database you are connecting to. With SQL server, I use Windows Authentication and let Windows worry about keeping tracking of the username and password.
When Windows authentication isn't possible, I get the user to input the connection information in a config dialog and then encrypt it and store it for when it is needed.
Finally, if all else fails. I configure the DSN to already have the authentication setup, so all I have to worry about in my code is passing in a "DSN=<dsnname>" to my connection string.
Michael
CP Blog [^]
|
|
|
|
|
Have 2 columns in the listControl. Don't want to edit the first Column in a ListControl.Have a click event for the ListControl.so
whenever Iam clicking on the 1st column,the whole row becomes editable.Want to make only the first column non-Editable.
|
|
|
|
|
Does anybody know how to manage SwapFile: change its size, find used space in it, etc.
just give me idea where to look for such functions....
|
|
|
|
|
i've downloaded the code of image content based retrieval project and after building the project with VC++ there were some errors in creating the exe file which was "can't load (ximage.h there is no such directory or library)".
so what i'm i supposed to do??
amirait
|
|
|
|
|
Any tips on how to generate report using C++ programming (MFC). I have worked with visual basic before and is aware that VB has their own built in reporting tool for report generation. But im not sure how to do that using C++ language. Do I need to use Crystal Report? The report will contain info that is retrieved from the database. This report should also support the print feature. Pls help me! Tks...
Best Regards,
xiAoYJia
|
|
|
|
|
BusinessObjects provide an API for Crystal Reports. You should be able to find example C++ code on their website.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Best approach is using crystal report. You can use the Crystal report control just like in VB by adding the its OCX to your project. Crystal report object itself is capable of printing. You can pass query to your report in vc++.
|
|
|
|
|
Tks for your reply! I didnt work with Crystal Report in Visual Basic. I used their built in reporting tool instead. I would appreciate if u could provide me more details on "You can use the Crystal report control just like in VB by adding the its OCX to your project". Or do u happen to know of any good links that provide useful info?
Best Regards,
xiAoYJia
|
|
|
|
|
OK. I could send you a sample application. Just send me you email or your MSN ID so that we could chat.
Using crystal report in vc++ is just like using any other registered control or active control if we would speak in vb. All you need is to add project reference to it, then drag the control to your dialog, assign a variable name to that control, then you can access the methods to display the report as simple as m_crystalreport.setaction() after initializing it.
To make it simple, here are the steps that i followed:
1. Install Crystal report
2. Create a dialog based application.
3. Click PROJECT->ADD TO PROJECT->COMPONENTS AND CONTORLS menu.
4. Locate under registered activex control the crystal report.
5. Click OK. Some info will prompt. Just click OK
6. Back to you resource viewer. A new icon will be listed in your Control Toolbar. If you hover your mouse pointer to it, it will have a tooltip indicating a crystal report...
7. Add that to your dialog.
8. Assign a variable name to it, using class wizard. Say you name it m_crystalCtrl;
9. Back to your class browser, crystal report interface classes will be added to your project. Dont bother about that.
10. add a button to your dialog, then add event hadler to it. say button _click event.
11. Assuming that you already created a report template( connected it with your db), then you can display the report by adding the following code:
m_crystalCtrl.SetReportFileName("MyReportFilename.rpt"); // change to you report filename
m_crystalCtrl.SetWindowMaxButton(TRUE);
m_crystalCtrl.SetWindowMinButton(TRUE);
m_crystalCtrl.SetProgressDialog(FALSE);
m_crystalCtrl.SetWindowShowProgressCtls(FALSE);
m_crystalCtrl.SetWindowState(2); //Maximized
m_crystalCtrl.SetDestination(0); //To Window = 0 Printer = 1.
m_crystalCtrl.SetAction(1);
m_crystalCtrl.Reset();
|
|
|
|
|
Hi all,
I need to create Korean font using MFC CreateFont() function Below i have given the code which i tried for creating the font.But the Korean characters are not getting displayed .Can some one help me in telling whats wrong with my code??
CFont nFont;
nFont.CreateFont(0,0,10,10,400,FALSE,FALSE,FALSE,JOHAB_CHARSET ,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH |FF_MODERN,(unsigned short *)"Batang");
CFont* pOldFont=(CFont *)pDC->SelectObject(&nFont);
pDC->TextOut(50,50,buffer);
pDC->SelectObject(&pOldFont);
I have written this code in the OnDraw() of my view class.Pls help me
Thanx in advance
Poorni
|
|
|
|
|
See this example on the GodeGuru forums. It shows you how to create Japanese text. The process is very similar for Korean text, but you use a different character set, a different face name, and different hex codes for the characters.
Follow the forum posts through one by one, and use the methods described there to discover the hex codes and stuff like that. Doctor Luz's post, where he shows an example code and the resulting character string, is a working example, as I tested them out myself as well.
Just use a different character set and a font. Also use Internet Explorer to determine what hex codes your text needs.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi...
forget abt this method to create font..
Use my method..
CFont *nFont = new CFont;
n_Font->CreatePointFont(200, "Batang");
CFont* pOldFont=(CFont *)pDC->SelectObject(&nFont);
pDC->TextOut(50,50,buffer);
pDC->SelectObject(&pOldFont);
I think it would work fine..also this font must be present in your system..
OK! Good bye..
|
|
|
|
|
hi,
Thanx for ur reply no the code u have given is also not working..Still the program is displaying junk characters only............Is something that i have left out in my code?????Do help me
|
|
|
|
|
HI its giving error at this line......The runtime error states that The memory location referred cannot be read.............Any ides y such error happens?????
VERIFY(nFont->CreatePointFont(200, L"Batang"));
|
|
|
|
|
Hi,
I'd like to add a maximize button to my property sheet and the following code does it. However, it also adds a minimize button which I do not want. The mimimize button is disabled but I would prefer to remove it completely. How can I remove it?
<br />
int MyPropertySheet::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
if (CPropertySheet::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
SetWindowLong(this->m_hWnd, GWL_STYLE, GetWindowLong(this->m_hWnd, GWL_STYLE) | WS_MAXIMIZEBOX);<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
Hi,
I want to find out whether some application is trying to access the network resource like internet (HTTP,SMTP POP,FTP etc etc. –any sort of network resource usage) or any other network resource like mapped drives,VPN etc.
I want to capture this .
Secondly I want to determine which application is trying to access that resource.
Regards
Tarun
Blue Pill or Red Pill........??
|
|
|
|
|
WinPCap[^] can help you capture the network traffic.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi, You might want to try Windows hooks for capturing network usage on individual application basis. Try detours library from Microsoft research http://research.microsoft.com/sn/detours/. Also if you are not very much familiar with hooks, then refer to articles on codeproject. http://www.codeproject.com/system/hooksys.asp.
Mayank Goyal
|
|
|
|
|
Hi out there...
I'm struggeling with the following question:
What is the better way to do painting?
- Have a WorkerThread that prepares data and an OnTimer handler that displays the data if modified
or
- Having a WorkerThread that holds a handle to a DC (or maybe memDC) that paints to the window whenever he thinks its due.
I'm trying to optimize my applications performance and lower the CPU usage. Maybe there are even more alternatives on how to do painting.
Which approach do you use ?
Regards,
Daniel
|
|
|
|
|
Danoo wrote:
- Have a WorkerThread that prepares data and an OnTimer handler that displays the data if modified
Sure, you can have a worker thread preparing data. The OnTimer() should be in the GUI thread, though. You must however, of course, correctly synchronize access to shared data.
Danoo wrote:
- Having a WorkerThread that holds a handle to a DC (or maybe memDC) that paints to the window whenever he thinks its due.
If you keep a DC and use it to paint in, then it's not a worker thread in my point of view, but a GUI thread. A memory DC might pass as appropriate in some extreme cases. But don't use multiple GUI threads. Just don't.
Before you think about any other alternative - are you following the #1 rule of optimization?
Dont't optimize until you have actually measured that it's necessary!
Just lowering the CPU usage is not a justified reason to optimize. Is the CPU usage too high? That's the question.
Danoo wrote:
Which approach do you use ?
Given the fact that I must optimize, I tend to stick to one thread only, unless the amount of number crunching required to update the GUI is massive.
I would probably use a class or private DC, since they exist for that particular purpose. When the timer fires, I would invalidate only changed areas and paint what I'd prepared between the timer events.
--
Dad, how strange it is that the pig can speak. *thoughtful pause* It must have lost its "oink". (my 3-year old daughter Moa, while watching Babe)
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|