|
Hello, the codegurus around the world.;)
Really? Did you use Access Database?
Access Database isn't the thread-safe.
That is, Access Database can't deal with con-corrent aceess on the web service.
SQL server or Oracle actually use TCP/IP, meaning Socket level exchange.
Or as long as you write the program with thread, Access database may be
the thread safe.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Just a question, I have created a group box with check boxes in it. I would like to use the graying out effect to gray out the rest of the check boxes. Can anyone help me know where to do this at. Do I do it in the function OnInitDialog() or where. I know to use the EnableWindow method, but am unsure as to where specifically to do that in my program. I have each check box defined as a member variable and I have a pointer to each check box. THanks for any help in advance.
|
|
|
|
|
If you disable ( grey out ) the other check boxes, you will not be able to click on them to select them, as they will be disabled. If they were being disabled based on sub choices depending on which one is clicked, then set it up in OnInit and set it to what it should become in the handler for clicking wach check box.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
On the surface this seems like a case where you might want to consider using radio buttons instead of check boxes, as it seems like you're trying to get the same functionality out of the checks that is built into a group of radios.
JMHO.
|
|
|
|
|
Hi,,
I have a function,,
CPoint Coordinates(CPoint pStart, CPoint pEnd)
{
return result;
result.x = pStart.x + pEnd.x;
result.y = pStart.y + pEbd.y;
return result;
}
and in my CView class, i have :
.
.
.
.
CPoint test = Coordinates(Start, End)
the compiler gives me the following error:
error C2664: 'Coordinates' : cannot convert parameter 1 from 'const class CPoint' to 'class CPoint &'Conversion loses qualifiers
what should i do?
Ehsan Behboudi
|
|
|
|
|
First, change Your coordinates function to create result first, then return it. As I suspect You have done this in code.
CPoint Coordinates(CPoint pStart, CPoint pEnd)
{
CPoint result;
result.x = pStart.x + pEnd.x;
result.y = pStart.y + pEnd.y;
return result;
}
Everything looks ok. But check, whether the method from within You are calling Coordinates function is const. This may be the source of the problem.
One more thing: I think that CPoint has already +CPoint operator defined:
void operator+=(POINT point);
CPoint operator+(POINT point) const;
|
|
|
|
|
You should also get rid of the return at the top so your code executes ;0)
If you need to, you can do a const_cast<cpoint> to remove the const-ness ( if it's coming in const from somewhere you cannot control). I'm sure operator + is defined for CPoint in any case.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
How can I manually set the height of the drop-down area for a CComboBox?
I've dynamically created a number of combo boxes to put on a dialog (they don't exist on the dialog resource), but when they are displayed the drop-down does not show the list because it's only about 1 pixel high. The list items are there because I can scroll between them using the arrow keys.
|
|
|
|
|
To change the ComboBox Drop-down Height all you need to do is press the arrow in the right of the comboBox. This will cause it to open. There you can change its height and compile.
I Hope this can help
Santiago Suárez R.
|
|
|
|
|
The comboboxes don't exist on a dialog resource for me to be able to change the drop-down height as you suggest (I am well aware of this approach!).
I need to be able to set the drop-down height from the code, becuase the comboboxes are created dynamically.
|
|
|
|
|
You can set the height of combo box dropdown by changing the height of the combobox.
Like:
m_wndCombo.SetWindowPos(NULL,0,0,200,40,SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
But If you make height too small their seem to be no effect.
Also the hright is rounded to integral value if CBS_NOINTEGRALHEIGHT style is not set.
|
|
|
|
|
Thanks very much
|
|
|
|
|
I wanted to fill a rectangle with a bitmap pattern. I would like to have a sample code for doing this.
Raj
|
|
|
|
|
In GDI+ it's a snap. For GDI, it's a little harder, but not much.
If your bitmap is 8 x 8 ( yeah, right ) then you can use a brush that holds it, but I've never used it and so the name escapes me.
CDC bmpDC;
bmpDC.CreateCompatibleDC(NULL);
CBitmap bmp;
bmp.LoadImage(IDB_BITMAP);
CBitmap * pOld = bmpDC.SelectObject(&bmp);
Now just do a stretchblt across from this DC to the rect you want to fill. If you want to tile, it's a little harder - you need to either create an intermeediate tiled bitmap or do the tiled drawing to make sure you don't go too wide or high. If you go too far in a bitmap that is the right size being prepared, GDI will just ignore the bits over the edges.
Here is a code snippet from my tiling method. The pDib is a paintlib DIBSection, so the moethods won't work with a CBitmap, but it will give you the idea.
case TRANSP_BMP_TILE:
{
for (int x = 0; x < pDib->GetWidth(); x += m_TranspBitmap.GetWidth())
for (int y = 0; y < pDib->GetHeight(); y+= m_TranspBitmap.GetHeight())
m_TranspBitmap.Draw(dc.m_hDC, x, y);
}
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I am having difficulty if i need to insert an image, text and button in a cell. Some of the cells in the column do not have buttons, but some do. This means that the indent/margin set in a button cell means that the images (aligned left) do not align, has anyone any ideas as to how to modify the code, set a default margin etc.?
Cheers, Bill
image text nobutton
image text nobutton
image text button
image text nobutton
image text button
see what i mean?
|
|
|
|
|
sorry, fixed it with setmargin()
Remember, Be excellent to each other
|
|
|
|
|
Hi y'all,
moving up in software development, I thought it was a good idea to dive into extention DLL's. I've developed a suite of database-access classes which has grown up to 30 files, so I thought it would be nice to pack all these in a .lib and .dll file so distribution would be easier.
One of the features of the classes is creating a taskbaricon (which is a Dundas component, derived from CWnd). But ever since I put my classes inside an MFC extention DLL, the creation of the taskbaricon fails. This is the reason why:
* First a window is created with CreateEx(0, AfxRegisterWndClass(CS_CLASSDC | CS_GLOBALCLASS), NULL, 0, 0, 0, 0, 0, NULL, NULL) However, AfxRegisterWndClass calls AfxGetInstanceHandle and returns a NULL-value or something. Even though MSDN says that AfxGetInstanceHandle should return the handle of the dll in this case...
* After the window creation an icon has to be extracted from the resource (which I also put inside dll). But as soon as the icon is created using ::LoadIcon(AfxFindResourceHandle(MAKEINTRESOURCE(nIDResource), RT_GROUP_ICON), MAKEINTRESOURCE(nIDResource)), things go wrong again. AfxFindResourceHandle calls AfxGetResourceHandle which also returns a NULL- or corrupt handle.
So, my question is:
How can I get the AfxGetInstanceHandle and AfxGetResourceHandle working well within my .dll??
Structured programming vs. chaotic mind boggling
|
|
|
|
|
Hello
I need to access a member-function of my MFC-app via the _beginthread-function.
_beginthread(pingthread,0,(void *) (szBuffer));
"pingthread" is
void CMyAppDlg::pingthread(void* parameter)
{ ... }
But _beginthread does not seem to accept MFC-member-functions.
Any solution?
thanks
|
|
|
|
|
pingthread has to be a static member function
|
|
|
|
|
I would suggest you to read one of newcomer's articales: http://www.pgh.net/~newcomer/callbacks.htm
Lirong
|
|
|
|
|
I'd do the following:
1) Create a global function :
void ThePingThread(void * pDlg)
{
if (pDlg != NULL)
{
( (CMyAppDlg *) pDlg)->PingThread() );
}
}
2) ...calling the pingthread function in your thread
void CMyAppDlg::pingthread()
{
pParameter = m_pParamter;
// Do your pinging stuff!
}
3) Start the trhead as follows:
void CMyAppDlg::RunPingThread(void* pParameter)
{
m_pParameter = pParameter;
_beginthread(ThePingThread, 0, this);
}
It works for me!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
When I try to compile the compiler reports an error in line:
( ((CServerListDlg*) pDlg )->pingthread() );
(translated from german )
"pingthread" : No access to protected element, which has been declared in class "CServerListDlg"
|
|
|
|
|
That's quite logical, because you have to make the pingThread function public.
If it's protected, it's quite impossible for a global function to access it...
Tell me if it worked for you!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
hi
I have a projecy in SDI and i want to tern it to an MDI
how do i do it ???
|
|
|
|
|
TO turn it into MDI is not impossible, but certainly interesting. Make an SDI and a MDI project in the class wizard and run a comparison program on them. There is an extra class in your MDI app for starters. Figure out the differences and apply. Repeat as necessary
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|