|
Thanks for the help from you 3, helped a lot and I have it working now =)
- Travis
|
|
|
|
|
I want to learn how to program a simple Databases.
What Database can i learn most from when am new??
I was thinking of making a simple text in a editbox and save it on a base,
where do i start??? Thank you
|
|
|
|
|
<<< In the name of GOD >>>
Hi.
I want to get string from Owner-Draw ListBox :
void CHlistbox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CString string;
CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rc = lpDrawItemStruct->rcItem;
UINT action = lpDrawItemStruct->itemAction;
UINT state = lpDrawItemStruct->itemState;
UINT index = lpDrawItemStruct->itemID;
if(action & ODA_DRAWENTIRE)
{
GetText(index,string);
pDC->FillSolidRect(rc,RGB(0,0,0));
pDC->SetTextColor(RGB(100,100,50));
pDC->TextOut(rc.left+1, rc.top+1, string); // PROBLEM IS THERE
}
}
Adding string with ListBox :
void TestDlg::OnOK()
{
m_listbox.AddString("Hadi Rezaie");
}
My other problem is when i added 1 string, i cant adding other string with ListBox.
Please help me ...
Hadi Rezaie
|
|
|
|
|
Is there a way to get a handle or a pointer to the scroll bar in a CListCtrl ?
Is there a way to disable and make the scroll bar in the CListCtrl class not appear?
Death reaches all
Your time will come billy boy
Eyal
|
|
|
|
|
Hallo everybody! I'm developing an application with other people and we are using components.
I'm developing some components and I would like to know if someone know if it's possible (or how) to choose dynamically the ID for the new component at runtime.
Thanks
Bye bye
Nicola
|
|
|
|
|
as far as i know the resource id's are a compile time thing that you would have a real hard time changing at run time ... its important to understand the difference between compile time and run time ... what you can and cant do
unless of course i dont understand what i'm talking about
always possible
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
You need to get with your fellow developers and standardize on a method to generate ID's. Basically, all you need to do is make sure that you don't duplicate the same number on the same dialog. One way to do this is allocate a range of ID's that you never use for static resources, and then create a function to allocate the ID's at runtime, which is simply a counter that returns a new number in the range everytime it's called.
|
|
|
|
|
First, I think you read this writings.
I want to know how to get ip address and customer id(client id).
so, I want to put in data(CString variables) value made from above structure.
I don't know this at all.
Please reply this question quickly.
Please... Please...
|
|
|
|
|
WSADATA wsaData;
struct sockaddr_in sock;
CString strHostname;
int lLen = 255;
WSAStartup(0x0101, &wsaData);
gethostname(strHostname.GetBuffer(lLen), lLen);
HOSTENT * lpHost = gethostbyname(strHostname.GetBuffer(lLen));
memcpy(&(sock.sin_addr), lpHost->h_addr_list[0], lpHost->h_length);
TRACE2 ("Host Name: %s IP address : %s\n",strHostname, inet_ntoa(sock.sin_addr));
WSACleanup();
Considderd to be the worlds fastest knoppenbonker.
10 Months of working experience with the worlds fastest copie paster(about 2000 lines a minute).
And experience with the one and only NewEra Guru.
|
|
|
|
|
I'm using CDataSource, CSession etc to work with some database.
This database is having, for example, one table with two columns.
One is a self-incrementing counter (index) and other is a value.
My task is to write a function like this:
long Add(long val) {
return index_of_val_added;
}
I'm doing it this way:
long Add(long val) {
CCommand< CAccessor< table > > t;
t.Open(session, "insert into table(val) values(-1);", NULL, NULL, DBGUID_DEFAULT, FALSE);
t.Close();
t.Open(session, "select * from table where val=-1;");
int id = t.m_id;
t.Close();
CString s;
s.Format("update table set val=%d where id=%d", val, id);
t.Open(session, s, NULL, NULL, DBGUID_DEFAULT, FALSE);
t.Close();
return id;
}
I know, that it is ugly... Could anybody show me the correct way to do it?
With the best regards, Vitaly.
|
|
|
|
|
I have a JPEG image to be printed onto the printer.How to this is possible in Windows NT
Raja sekhar
|
|
|
|
|
Use one of the classes available online ( like www.paintlib.de ) to load the image, then you'll be able to print it just like a BMP.
Christian
|
|
|
|
|
I've defined a private message in my MainFrm.h as below:
#define UWM_USER_APPLY WM_APP+17
afx_msg LRESULT OnUserApply(WPARAM wparam, LPARAM lparam);
In MainFrm.cpp, I've added this within the message-map macro:
ON_MESSAGE(UWM_USER_APPLY,OnUserApply)
I've created a property sheet, when user press "Apply" button, I do the following:
void COptionSheet::OnApply(){
GetActivePage()->UpdateData();
HWND hwnd=AfxGetMainWnd()->m_hWnd;
::SendMessage(hwnd,UWM_USER_APPLY,(WPARAM)this,0);
m_pg1.SetModified(FALSE);
m_pg2.SetModified(FALSE);
}
It work fine at debug version, when I build the release version, it'll cause "illegal operation" at the line:
::SendMessage(hwnd,UWM_USER_APPLY,(WPARAM)this,0);
If I simply changed it to a standard WM_, it'll work. For example:
::SendMessage(hwnd,WM_ENABLE,(WPARAM)this,0);
I'm using Visual C++ 6.0 with SP4 on Win98. I've tried both in NT and Win98, both have the same bad result.
Please help. Thanks in advance.
|
|
|
|
|
I've seen this happen recently - pretty much the same thing you are doing.
First 'workaround' I found was to change the macro to ON_COMMAND - which in my case didn't make a lot of sense, since my message was not a user command.
I ended up sending the message to another window and that seemed to work as a WM_MESSAGE.
I've also seen it land on the illegal instruction code (in nn, I believe) when you add a handler method and leave out a required parameter declaration (e.g. OnMyMessage() instead of OnMyMessage(UINT num)
And, as you say, only in release. Sigh... aren't macros wonderful?
|
|
|
|
|
If I had an app that used Winsock, how would I SOCKS-enable it? Any good tutorials? Thanks in advance...
--
Pikapika,
Capt. Jean-Luc Pikachu
|
|
|
|
|
The following C version works fine.
/* C Version */
#include conio.h
#include stdio.h
int main ()
{
char ch;
printf ("Type a character: ");
ch = getch();
printf ("\nYou typed: %c\n", ch);
return 0;
}
However the C++ version does not work the same way. After typing a key, I have to press the enter key to get the program going.
/* C++ version */
#include iostream
using std::cout;
using std::cin;
int main ()
{
char ch;
cout << "Type a character: ";
cin.get(ch);
// ch = cin.get();
cout << "You typed: " << ch << "\n";
return 0;
}
|
|
|
|
|
It's a messed up question with a fairly messed up answer. If you're in Windows, the iostream libraries may not work the happy way you want. That's the easy copout answer.
The longer answer (page 72 of the March 2001 issue of C/C++ User's Journal, an EXCELLENT magazine) says that you have to go down below istream/ostream to the std::streambuf class. You'll want to look for streambuf::sbumpc as a possible solution to your problem.
Unfortunately, my expertise is in VBScript (ASP 2.0) and PHP, and my attempts to use C/C++ usually make me scream stuff that would get my booted from this board. But I HAVE had the same sort of problems you've had, you're not alone, and the solution is non-obvious. That, and I didn't fully understand enough of the article to explain it to you. Check out the magazine (http://www.cuj.com/) and good luck.
--
Pikapika,
Capt. Jean-Luc Pikachu
|
|
|
|
|
Can I just second that CUJ is a fine, fine mag, ( although my March isue has not yet arrived as I am in Australia ), and that you should subscribe.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I'm trying to show the headers of all the records in a listbox :
1. is there a easiest/better fitted control for showing headers of records ?
2. whats my next step for loading a dialog with all Record Data after a row had been selected ? How do i get the index of the Record (is there a return value in ListBox ??) or, How to retrive the Record from the ListBox ?
Thanks for your help,
Ariel.
|
|
|
|
|
Hi there,
Well i'm trying to figure out a way to lock a record when i'm editting it and it seems i can't find the way.
First, I'm using ODBC and my DB is both in Access and FoxPro - i'm not sure wether the lock of the record is handled by ODBC Drivers or the DB itself - so if somone can help me with that i'll be more than happy.
Second, I'm trying to change the CRecordset::SetLockingMode(CRecordset::pessimistic) and i get an exception which tells me i'm actualy back to default CRecordset::Optimistic (Locking Mode) - those this have to do with my ODBC Driver or my Access DB.
Third, is there a flag in CRecordset which tells me whether the Record is edited by another user or only the ODBC/DB (???) handles and know it ?
Actually what i'm asking in a one sentence is : Can i check if a record is edited by another user in another process or i have to put my own Semaphore for this ???
Thank you alot for reading all this and much more if help given,
Ariel.
|
|
|
|
|
First, I think you read this writings.
I want to know how to get ip address and customer id(client id).
so, I want to put in data(CString variables) value made from above structure.
I don't know this at all.
Please reply this question quickly.
|
|
|
|
|
Can you read?
WSADATA wsaData;
struct sockaddr_in sock;
CString strHostname;
int lLen = 255;
WSAStartup(0x0101, &wsaData);
gethostname(strHostname.GetBuffer(lLen), lLen);
HOSTENT * lpHost = gethostbyname(strHostname.GetBuffer(lLen));
memcpy(&(sock.sin_addr), lpHost->h_addr_list[0], lpHost->h_length);
TRACE2 ("Host Name: %s IP address : %s\n",strHostname, inet_ntoa(sock.sin_addr));
WSACleanup();
Considderd to be the worlds fastest knoppenbonker.
10 Months of working experience with the worlds fastest copie paster(about 2000 lines a minute).
And experience with the one and only NewEra Guru.
|
|
|
|
|
I want to put in data(CString)...
Would you do me a favor?
|
|
|
|
|
I want to pass an array of strings from a VB application to a C++/MFC DLL
I then want to update that array in the DLL and pass it back to the VB app
I know how to pass a string to the DLL but not an array of strings.
Can anyone help me out.
Thanks
|
|
|
|
|
You know the complex bit about passing strings (ie: as BSTR's)
To pass an array of strings you need to use a SAFEARRAY.
As this can be a bit fiddley I have suggested to people in the
past to instead write a function AddString which builds up the
array and then one to Execute to do the action to the array.
Jules
|
|
|
|