|
I make most of my menus Mirc/Trillian-like, this is a simple way;
Use TTreeView & TNotebook (or TPagecontrol);
Make an OnChange-event in your Treeview, eg:
-
<br />
void __fastcall TForm1::TreeViewChange(TObject *Sender, TTreeNode *Node)<br />
{<br />
<br />
TTreeNode *CurItem = TreeView->Selected;<br />
Notebook->ActivePage = CurItem->Text;<br />
<br />
}<br />
-
The Names of the options and the Pages should of course be the same in this example.
So explore TNotebook &/ TPagecontrol!
Best of luck, Jeroen.
|
|
|
|
|
Hi,
anyone here was successful at applying themes for a DLL project? Here's what I've done, but with negative results
stdafx.h :
// XP Themes
#include "commctrl.h"
#define ISOLATION_AWARE_ENABLED
#define MANIFEST_RESOURCE_ID 2
project.rc :
MANIFEST_RESOURCE_ID 24 MOVEABLE PURE "res\\project.dll.manifest"
ProjectDlg.cpp :
OnInitDialog(...)
{
INITCOMMONCONTROLSEX commCtrlsInfo;
commCtrlsInfo.dwICC = ICC_ANIMATE_CLASS | ICC_BAR_CLASSES | ICC_COOL_CLASSES | ICC_DATE_CLASSES | ICC_HOTKEY_CLASS
| ICC_INTERNET_CLASSES | ICC_LISTVIEW_CLASSES | ICC_PAGESCROLLER_CLASS | ICC_PROGRESS_CLASS
| ICC_TAB_CLASSES | ICC_TREEVIEW_CLASSES | ICC_UPDOWN_CLASS | ICC_USEREX_CLASSES | ICC_WIN95_CLASSES;
commCtrlsInfo.dwSize = sizeof( INITCOMMONCONTROLSEX );
InitCommonControlsEx( &commCtrlsInfo );
}
HELP!
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
Hi,
I want to add StringGrids to dynamically created Tabs from TTabContol where the Tab-names are read from a file and from that same file also the info in the Grids (per/tab);
-
1. In progr. env. created TabControl;
2. Onload read from the file, first the Tabs;
3. TabControl->Tabs->Add("TabFromFile1");
4. So we've created 1 Tab, now I want to add a StringGrid on thát Tab:
(This is wat I thought... but misses the page to put it on... )
<br />
TStringGrid *Grid = new TStringGrid(TabControl);<br />
Grid->Top = 10;<br />
Grid->Left = 10;<br />
Grid->etc...<br />
<br />
Grid->Visible = true;<br />
Grid->Parent = TabControl;<br />
-
The (seems to me) stupid solution is to put the grids on the form and bring them to the front when called upon...
Anybody knows the solution?!
Thx! Jeroen.
|
|
|
|
|
Never mind, found it;
I'll also use PageControl iso. TabControl;
// Create a new page in PageControl1...
TTabSheet *Page = new TTabSheet(this);
Page->PageControl = PageControl1;
Page->Caption = "TabFromFile1";
// Add Grid...
TStringGrid *Grid = new TStringGrid(this);
Grid->Parent = Page;
Grid->Top = 10;
Grid->Left = 10;
|
|
|
|
|
I'm using c++ console and would like to know how to get a size of a specific file, probably in the same folder and if it is empty do something else do something else... Please help
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Use FindFirstFile()
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Can you make that a little bit more clearer, I never heard of that function too.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Snyp wrote:
Can you make that a little bit more clearer
Nope. If you want to be a programmer, you must learn to use reference material. Use the following link to look up the API function FindFirstFile:
http://msdn.microsoft.com/library/default.asp[^]
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I have a Wizard 97 working great. Only problem is that the button behavior is not as documents. Specifically, the "Back" button is enabled on the First/Welcome page and the "Next" button is not replaced with a "Finish" button on the Last/Completion page.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Already found an answer buried in the documentation.
Every time a page is made active, you receive a WM_NOTIFY message with PSN_SETACTIVE in the code. You then have to send a PSM_SETWIZBUTTONS to the parent with the appropriate flags. How annoying (why didn't they just make the default behavior the expected one and let you override it for the exceptions?)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi.
I'm currently developing a program that uses a pool of worker threads to create network connections. My current model does not work however. I want to have all the network and socket code in a DLL so I can update it as necessary without having to re write the program.
I am looking for the best way to impliment this. Is it best to create say 10 sockets (one for each thread) and have the thread use that socket to connect() with until the pool is empty, or is it better to create a new socket each time the thread is called?
Also what is the best way to impliment non-blocking sockets in this situation? The only reason I am using non-blocking sockets in a worker thread is so that I can set a timeout for connecting and send/recv calls.
I have been having great trouble getting this to work and any thoughts, opinions are welcome however I would greatly appreciate some sample code.
Thanks,
Mike
What I have tried:
The following code is held in a dll. The dll and it's functions are resolved before the thread pool is created. As I create the worker threads they are each given the pointer to these functions (at the moment there is only ServerConnect). I use the pointer to call the functions from the worker threads.
SOCKET* pSocket;
.
.
extern "C" __declspec (dllexport) int ServerConnect (LPCSTR lpServerName, UINT nPort)
{
struct hostent* pHostent;
unsigned int addr;
struct sockaddr_in server;
int nErrorValue;
WSADATA wsaData;
if(WSAStartup(0x101,&wsaData)) {
AfxMessageBox("WSAStartup failed");
return-1;
}
pSocket = new SOCKET;
*pSocket=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(*pSocket==INVALID_SOCKET) {
AfxMessageBox("socket failed");
return -1;
}
if(inet_addr(lpServerName)==INADDR_NONE)
pHostent=gethostbyname(lpServerName);
else {
addr=inet_addr(lpServerName);
pHostent=gethostbyaddr((char*)&addr,sizeof(addr),AF_INET);
}
if(pHostent==NULL) {
AfxMessageBox("gethostbyname/addr failed");
closesocket(*pSocket);
return -1;
}
server.sin_addr.s_addr=*((unsigned long*)pHostent->h_addr);
server.sin_family=AF_INET;
server.sin_port=htons(nPort);
if(connect(*pSocket,(struct sockaddr*)&server,sizeof(server))==SOCKET_ERROR) {
nErrorValue = WSAGetLastError();
if(nErrorValue==WSAEINVAL)
AfxMessageBox(CString("connect() failed: ") + CString("WSAEINVAL"));
else
AfxMessageBox("connect() failed for another reason");
closesocket(*pSocket);
return -1;
}
return *pSocket;
}
This works fine if I use 1-5 threads, but above that and connect() returns WSAEINVAL.
Any clues anyone?
|
|
|
|
|
One solution is one worker thread and event object to signal a new connection.
Kuphryn
|
|
|
|
|
Hi,
Thanks for answering.
I think that is a good solution for most cases however my program will be handling nothing but a huge load of network traffic. The only way I can see to do this efficiently is with a thread pool.
I realised that most of my trouble is in using new to create a new SOCKET variable. This does not work. I created a variable local to the function and carry it around for each thread - this seems to work ok, but I haven't managed to get this to work fully with non-blocking sockets.
Mike
There are 10 types of people in the world
Those who understand binary, and those who don't
|
|
|
|
|
Hi
I write a Html Editor and I want to get the hole text in a CString. I use CCrytalView. I use for this process
void GetText(const CPoint &ptStart, const CPoint &ptEnd, CString &text);<br />
and I wrote something like this:
CPoint ptSelStart, ptSelEnd; <br />
CRect rect; <br />
<br />
GetClientRect(&rect); <br />
<br />
ptSelStart.x = rect.top; <br />
ptSelStart.y = rect.left; <br />
<br />
ptSelEnd.x = rect.right; <br />
ptSelEnd.y = rect.bottom; <br />
<br />
GetText(m_ptSavedSelStart,m_ptSavedSelEnd,strTemp);
But I always get an Mistake at "GetText()". Why?! Whats is my mistake?!
this works correctly
CPoint ptSelStart, ptSelEnd; <br />
GetSelection(ptSelStart, ptSelEnd); <br />
<br />
GetText(ptSelStart, ptSelEnd, strTemp);
But when I use this, I have always to select the hole text and I dont want that. Can anybody help?!
|
|
|
|
|
Can you tell me where I can find information about GetText() and also about CCrytalView. Is GetText() a Win32 function? How about CCrytalView. I searched in MSDN, I do not find any info. After knowing this, I will try to answer your question.
|
|
|
|
|
Hi !
Just came to thinking it, has anyone else experienced problems with this driver and the latest version of Microsoft Visual Studio ? I am using .NET 2003 Architect version, and if I use the MFC ODBC Consumer wizard to add a predefined datasource to my project, the entire IDE crashes.
The wizard is capable of connecting to the database, allowing me to pick up the tables I wish to use. It crashes after a small delay when I click on 'Finish'.
This is really eluding me, as neither the logs or the debug version of the driver report any problems. It seems to be a Visual Studio -related problem. Any clues ?
The old 2.50 version of the driver worked flawlessly, but it's too outdated for the project
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
This problem seems to be related with the "Bind All" selection of the wizard. Leaving it out will cause the wizard to function flawlessly.
Luckily MSDN is full of articles about dynamic binding, and the usage of RFX.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi,
I want to generate a demo or tutorial for my software
in which a tutorial should do all working of mouse and keyboard automatically i.e. should click on menu item then
when dialog appear it shuld fill it. and click on OK or whatere button.
How to do this stuff programmatically.
Thanx.
|
|
|
|
|
Have a look at the SendInput Windows API function.
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I have an SDI app with CHtmlView as its view. I want to make it full screen, no menus, toolbars or nothing. Similar to internet explorers full screen (F11), but without the toolbar.
How can I do this?
|
|
|
|
|
I dont know how get how many bytes which Sent and Received through by internet connection ?
help me !
|
|
|
|
|
Are you referring to a network monitoring application?
Kuphryn
|
|
|
|
|
is there a shell function to HTML Encode a string? Couldn't find anything sutable in MSDN
(I guess so, so the question is "what's it's name?")
"Vierteile den, der sie Hure schimpft mit einem türkischen Säbel."
mlog || Agile Programming | doxygen
|
|
|
|
|
After posting a similar message a bit before, I did not get a good response so here is what I wrote. If you find something standard, let me know!
<br />
CString MakeXMLProof(const CString & strString) const<br />
{<br />
<br />
CString strResult;<br />
for ( int nRep = 0; nRep < strString.GetLength(); nRep++)<br />
{<br />
TCHAR car = strString[nRep];<br />
if ( car < 256 )<br />
{<br />
switch ( car )<br />
{<br />
case '"':<br />
strResult+=_T(""");<br />
break;<br />
case '<':<br />
strResult+=_T("<");<br />
break;<br />
case '>':<br />
strResult+=_T(">");<br />
break;<br />
case '&':<br />
strResult+=_T("&");<br />
break;<br />
case '\'':<br />
case '\\':<br />
case '%':<br />
case '^':<br />
case '[':<br />
case ']':<br />
case '`':<br />
case '+':<br />
case '$':<br />
case ',':<br />
case '@':<br />
case ';':<br />
case '/':<br />
case '!':<br />
case '#':<br />
case '?':<br />
case '=':<br />
{<br />
CString strBuffer;<br />
strBuffer.Format(_T("&#%d;"),car);<br />
strResult+=strBuffer;<br />
}<br />
break;<br />
default:<br />
strResult+=(char) car;<br />
}<br />
}<br />
else<br />
{<br />
CString strBuffer;<br />
strBuffer.Format(_T("&#%d;"),car);<br />
strResult+=strBuffer;<br />
}<br />
}<br />
<br />
return strResult;<br />
}<br />
<EDIT>By the way, getting the HTML tags not to be interpreted in the post is a nightmare so I hope it makes sense</EDIT>
|
|
|
|
|
(I am using the * to fill in for the &)
I didn't take too much time going through your code, but it looks like you would break HTML that was already formatted. Like if your parser came across "*lt;" (already formatted) it would change it to "*amp;lt;" which would display as "*lt;" instead of "<" :
*lt; = <
*amp;lt = &lt;
|
|
|
|