|
Hi everyone ! Do anybody know ( because I took from here many useful links ) an auto complete control implementation of CEdit or CComboBx control ? I found HEREsomething interesting , but not working on SDI/MDI application , so is in vain , and autocomplete implementation is based on CList , not on CListCtrl ... any hint or link will be very appreciated ! Thanks in advance !
|
|
|
|
|
|
Thanks , first sample is allready implemented , second is not quite what I need ... I keep search , or , if I can , I buld myself ... thanks again !
|
|
|
|
|
i am a newbie and creating a project in c language on windows platform.
i am trying to develop a small application using winAPI 32. I am taking online tutorial from winprog.org ,in my tutorial i am creating a window from a given code but when i run the code ,my window name appearsll to be in different language .The code i used is given below. I am not able to understand why this sia happening . please help me .. I am using vc++ express edition 2008 on window 7.
i'll be very thankful to you.
#include <windows.h>
const char g_szClassName[] = "myWindowClass";
// Step 4: the Window Procedure
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
//Step 1: Registering the Window Class
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL, "Window Registration Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
// Step 2: Creating the Window
hwnd = CreateWindowEx(
WS_EX_CLIENTEDGE,
g_szClassName,
"The title of my window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
NULL, NULL, hInstance, NULL);
if(hwnd == NULL)
{
MessageBox(NULL, "Window Creation Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
// Step 3: The Message Loop
while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
|
|
|
|
|
Always use code block and paste ur code in betweenthat block. code block is right on the text field where you write your question. Number of people answering you question, will dramatically change. TRUST ME.
|
|
|
|
|
right.
|
|
|
|
|
You might find the properly formatted code cross posted in the QA...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
See, that is a problem with editable posts: the enquirer did not format properly in Q&A, someone cleaned it up, and the enquirer probably didn't learn a thing; he may get an answer and never figure how to use PRE tags.
|
|
|
|
|
Yes, no HTML , but see the positive side: he might go on and probably learn a bit of software development.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
gateway23 wrote: ,my window name appearsll to be in different language
What do you mean, exactly?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
He asks why the window title says "Finestra di base"...
|
|
|
|
|
Luc Pattyn wrote: He asks why the window title says "Finestra di base"...
Well, I see NOTHING wrong in that.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
sorry for the inconvenience , i want to say ..when i run the code ,the windows title appears comes in different language ,it must come in english but it appears in different language.
|
|
|
|
|
hello guys...I added ListBox control on the form, so it accessible in MyProjDlg.cpp only. Now I want to add something to this ListBox from some other class "MyClass.cpp". So I made a function setter() in MyProjDlg.h like this....
#pragma once
#include "afxwin.h"
class MyProjDlg: public CDialog{
public:
.....
protected:
.....
public:
afx_msg void OnAdd();
afx_msg void OnDelete();
afx_msg void OnShow();
void setter(LPSTR str);
CListBox ListVar;
};
and gave its its implementation in MyProjDlg.cpp
void setter(LPSTR str) {
MessageBox(NULL,str,"",NULL);
}
and used it in MyClass.cpp like this..
LPSTR str = "Rumble in the Bronx"
for (int i=0; i<5; i++) {
setter(str);
}
problem is,setter()it is not accessible in the MyClass.cpp....why
|
|
|
|
|
setter() is a member of the MyProjDlg class so can only be called on an object of that class.
It's time for a new signature.
|
|
|
|
|
well i tried this
CMyProjDlg asd;
asd.setter();
and this
CMyProjDlg *asd;
asd->setter();
in both cases the intellisense is not showing the function, off course which means it is not available.
modified on Sunday, September 19, 2010 8:43 AM
|
|
|
|
|
Did you think to #include "MyProjDlg.h" in your cpp file? Also note that in case 2 you have not initialised your pointer to actually point to an object; don't be fooled by it possibly working.
It's time for a new signature.
|
|
|
|
|
does your failing .cpp file include all necessary .h files?
|
|
|
|
|
since it is a small tapi app so im including in MyClass.cpp
stdafx.h
tapi.h
if I include
MyProjDlg.h
I get error: C2065
|
|
|
|
|
overloaded Name wrote: I get error: C2065
then solve that. Not including a necessary header never is the solution.
|
|
|
|
|
Hi
how do i use XlTable format in DDE server application? to connect excel client.
Zo.Naderi-Iran
|
|
|
|
|
I am trying to create a simple to program to encrypt a file but I am having a lot of trouble with accessing the file. Firstly, whenever I try to access the file fstream's fail() always returns true.
If I take the check to fail() from my code it works fine encrypting the file but when I go to decrypt it there are artifacts in the file (2 extra bytes in my test file).
here is the code in question:
#define macro_encrypt (int) Byte + 25
#define macro_decrypt (int) Byte - 25
void fn_Decrypt()
{
char oldFilename[200];
char newFilename[200];
cout << "Enter Filename: ";
cin >> oldFilename; cout << endl;
cout << "Enter new Filename: ";
cin >> newFilename; cout << endl;
ifstream infile;
ofstream outfile;
char Byte;
infile.open(oldFilename, ios::in | ios::binary);
outfile.open(newFilename, ios::out | ios::binary);
while (!infile.eof())
{
char NewByte;
Byte = infile.get();
NewByte = macro_decrypt;
outfile.put(NewByte);
}
infile.close();
outfile.close();
fn_start();
}
I input a text file:
hello encryption
I get this (notepad output):
~……ˆ9~‡|‹’‰‚ˆ‡
And when I go to decrypt that file I get this:
hello encryptionÿæ
What makes this all the more frustrating is that when I compile the code this is based on it works fine. I can't see why it would work and mine won't, they are functionally identical (from what I can see).
Does anyone know why this is happening and/or how to fix it?
|
|
|
|
|
The artifacts are due to the way you're controlling the loop. Check what std::istream::get actually returns. Note that your cyphertext already has an extra character in it so your encrypt is part of the problem.
Just out of interest, as you're programming in C++ and not C:
- get rid of all the explicit opens/closes, you don't need them, destructors are wonderful things
- instead of letting a user crash your code by entering a filename of longer than 200 characters use std::strings and std::getline
- don't use macros, a pair of functions would have worked as well and enabled you to use the same code for encryption and decryption (the same goes for C BTW)
I'd also consider splitting the encrypt/decrypt bits of your code from all the guff asking for filenames, then you'd have something you can unit test without all the nuts ache of entering files all the time.
Cheers,
Ash
|
|
|
|
|
So a value declared int in C++.
Is signed.
However if I choose unsigned and assigned a negative value.
It should be zero.
Instead I get a large value, based on the most significant bit being 1 (representing the sign value).
And whatever was the original value being assigned is deducted from that value.
So -0, if nothing is to be deducted.
Someone should it be doing this?
|
|
|
|
|
C++ does no checking at runtime when doing automatic conversions. The bits from the signed int are simply crammed into the unsigned int. A negative integer has the high bit set so in the unsigned world it looks like a large number. If you set the warning level to 4, a good idea in general, with VC++ you'll get a signed/unsigned mismatch warning at compile time. You should look at all warnings to make sure you're not shooting yourself in the foot accidentally and fix them with proper casts, etc, so your compiles are totally clean. That will save you a lot of work in the long run looking for subtle bugs like the wrap around you're mentioning.
Once you agree to clans, tribes, governments...you've opted for socialism. The rest is just details.
|
|
|
|